There are three compute functions in my code.
But I got the error.
Odoo Server Error
Traceback (most recent call last):
File "/vagrant/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/vagrant/odoo/odoo/http.py", line 682, in dispatch
result = self._call_function(**self.params)
File "/vagrant/odoo/odoo/http.py", line 358, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/vagrant/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/vagrant/odoo/odoo/http.py", line 346, in checked_call
result = self.endpoint(*a, **kw)
File "/vagrant/odoo/odoo/http.py", line 911, in __call__
return self.method(*args, **kw)
File "/vagrant/odoo/odoo/http.py", line 530, in response_wrap
response = f(*args, **kw)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1359, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1351, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/vagrant/odoo/odoo/models.py", line 6165, in onchange
value = record[name]
File "/vagrant/odoo/odoo/models.py", line 5640, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/vagrant/odoo/odoo/fields.py", line 979, in __get__
raise ValueError("Compute method failed to assign %s.%s" % (record, self.name))
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/vagrant/odoo/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/vagrant/odoo/odoo/http.py", line 314, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Compute method failed to assign meeting.request(<NewId 0x7f4760a316d8>,).description
I have assigned empty value in my function.
Like self.request_srcmst_names = ''、self.date = ''、self.editable = False
But it still can't work. I don't know which function is wrong.
class MeetingRequest(models.Model):
_name = 'meeting.request'
request_srcmst_names = fields.Char(compute=_compute_request_srcmst_names)
date = fields.Date(compute=compute_date, search=search_date)
#api.depends('request_srcmst_ids')
def _compute_request_srcmst_names(self):
self.request_srcmst_names = ''
for record in self:
name = []
for request_srcmst in record.request_srcmst_ids:
name.append(request_srcmst.meeting_srcmst_id.name)
record.request_srcmst_names = ', '.join(name)
#api.depends('start_date')
def compute_date(self):
self.date = ''
for record in self:
if record.start_date:
real_date = pytz.utc.localize(datetime.datetime.strptime(record.start_date, '%Y-%m-%d %H:%M:%S')).astimezone(pytz.timezone(config['timezone'])).date()
record.date = real_date
class MeetingRequestSrcmst(models.Model):
_name = 'meeting.request.srcmst'
editable = fields.Boolean(compute=_compute_editable)
def _compute_editable(self):
self.editable = False
for record in self:
if record.hre_empbas_id.res_users_id.id == self.env.uid or record.create_uid.id == self.env.uid:
record.editable = True
How can I fix the function? Please give me some suggestions. Thanks!
I think it's syntax error. You forget to put a quote around function name. Computed function name should be inside a quote – compute='compute_date'. So is search function.
In your case,
date = fields.Date(compute='compute_date', search='search_date')
request_srcmst_names = fields.Char(compute='_compute_request_srcmst_names')
Inside your functions for computed fields, you can remove :
self.editable = False
self.date = ''
self.request_srcmst_names = ''
As I can see, you are trying to assign value to a field that does not exist in the database.
Your code:
request_srcmst_names = fields.Char(compute=_compute_request_srcmst_names)
Replace it with below then it will work:
request_srcmst_names = fields.Char(compute='_compute_request_srcmst_names', store=True)
compute field by default has store=False. To make it store you need pass parameter store=True.
Hope the provided solution works for you!
Related
I don't know where my problem is. Because years is char field must be string not bool.
I feel really frustrated. What can I do to fix this problem?
Any sort of help will be much appreciated!
Please give me some suggestions. Thanks!
Here is my code:
class HreDetailList(models.EcoModel):
_name = "hre.detail.list"
def _compute_holiday_flag(self):
for record in self:
record.work_on_holiday = False
now_year = int(record.years[:4])
next_year = now_year + 1
holiday_obj = self.env['hra.holiday']
holiday_data = holiday_obj.search([('holi_yy', 'ilike', next_year),
('holi_name', '=', 'Xmas')])
change_obj = self.env['hre.changedtl']
change_data = change_obj.search([('hre_empbas_id.emp_no', '=', record.emp_no),
('trans_flag', '=', True),
('lt_startdate', '=like', record.years[:4] + '%')])
for change_datadtl in change_data:
if change_datadtl.chg_kind == '6M' or change_datadtl.chg_kind == '6N' or change_datadtl.chg_kind == '6L':
if holiday_data.holi_date >= change_datadtl.lt_startdate and holiday_data.holi_date <= change_datadtl.lt_enddate:
record.work_on_holiday = True
break
else:
record.work_on_holiday = False
years = fields.Char(string='Year', size=7, required=True)
work_on_holiday = fields.Boolean(compute=_compute_holiday_flag, string='Work on holiday')
I am getting following error: TypeError: 'bool' object is not subscriptable:
Odoo Server Error
Traceback (most recent call last):
File "/vagrant/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/vagrant/odoo/odoo/http.py", line 682, in dispatch
result = self._call_function(**self.params)
File "/vagrant/odoo/odoo/http.py", line 358, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/vagrant/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/vagrant/odoo/odoo/http.py", line 346, in checked_call
result = self.endpoint(*a, **kw)
File "/vagrant/odoo/odoo/http.py", line 911, in __call__
return self.method(*args, **kw)
File "/vagrant/odoo/odoo/http.py", line 530, in response_wrap
response = f(*args, **kw)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1359, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1351, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/vagrant/odoo/odoo/models.py", line 6165, in onchange
value = record[name]
File "/vagrant/odoo/odoo/models.py", line 5640, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/vagrant/odoo/odoo/fields.py", line 972, in __get__
self.compute_value(recs)
File "/vagrant/odoo/odoo/fields.py", line 1111, in compute_value
records._compute_field_value(self)
File "/vagrant/odoo/odoo/models.py", line 4037, in _compute_field_value
field.compute(self)
File "/vagrant/odoo/addons/hre_formwork/models/hre_formwork.py", line 3887, in_compute_holiday_flag
now_year = int(record.years[:4])
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/vagrant/odoo/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/vagrant/odoo/odoo/http.py", line 314, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: 'bool' object is not subscriptable
I have state filed which is a Selection field. I want to group the records based on this state field in kanban view.
here is my code:
*.py
state = fields.Selection([('draft','Draft'),('process','Processing')
,('intransit','In-transit'),('done','Delivered'),('cancel','Canceled')],
default="draft",string="Status", track_visibility="onchange",
group_expand='_expand_states',index=True)
#api.model
def _expand_states(self, states, domain, order):
return [key for key, val in type(self).state.selection]
But i am getting this error:
> Traceback (most recent call last):
File "/home/user/Projects/odoo-10/odoo/http.py", line 642, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/user/Projects/odoo-10/odoo/http.py", line 684, in dispatch
result = self._call_function(**self.params)
File "/home/user/Projects/odoo-10/odoo/http.py", line 334, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/user/Projects/odoo-10/odoo/service/model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "/home/user/Projects/odoo-10/odoo/http.py", line 327, in checked_call
result = self.endpoint(*a, **kw)
File "/home/user/Projects/odoo-10/odoo/http.py", line 942, in __call__
return self.method(*args, **kw)
File "/home/user/Projects/odoo-10/odoo/http.py", line 507, in response_wrap
response = f(*args, **kw)
File "/home/user/Projects/odoo-10/odoo/addons/web/controllers/main.py", line 895, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/user/Projects/odoo-10/odoo/addons/web/controllers/main.py", line 887, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/user/Projects/odoo-10/odoo/api.py", line 687, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/home/user/Projects/odoo-10/odoo/api.py", line 672, in call_kw_model
result = method(recs, *args, **kwargs)
File "/home/user/Projects/odoo-10/odoo/models.py", line 1939, in read_group
result = self._read_group_raw(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
File "/home/user/Projects/odoo-10/odoo/models.py", line 2052, in _read_group_raw
aggregated_fields, count_field, result, read_group_order=order,
File "/home/user/Projects/odoo-10/odoo/models.py", line 1680, in _read_group_fill_results
groups = self.env[field.comodel_name].browse(group_ids)
File "/home/user/Projects/odoo-10/odoo/api.py", line 760, in __getitem__
return self.registry[model_name]._browse((), self)
File "/home/user/Projects/odoo-10/odoo/modules/registry.py", line 177, in __getitem__
return self.models[model_name]
KeyError: None
How can i solve this?
Have you put default_group_by="state" in xml file where kanban tag is placed as an attribute.
Remove the group_expand method and remove attribute from field, because it's a selection field so you don't need to return ids, just place the attribute default_group_by="state" in xml file and you'll see the result.
According to source code documentation, the method defined in group_expand should return a list of all aggregated values that we want to display for this field, in the form of a m2o-like pair (key,label).
The _read_group_fill_results method will always try to get the comodel_name of the field to build groups and because the comodel_name is not defined for selection fields, Odoo will raise a KeyError: None.
Unfortunately, returning a list of values that will be used as groups is available since Odoo-11.
The objective is to take the sale date and create a plan for automatic visits, 2 visits per year for three years, and i can do it in older version of odoo but now i get this error.
that worked in openerp 7, but now i want to do it in Odoo 11.0 Python 3, really i don't get it what i missed
class garantias(models.Model):
_name = 'itriplee.garantias'
equipo = fields.Many2one('itriplee.equipos', 'Equipo')
fecha_de_venta = fields.Date('Fecha de Venta', related='equipo.venta', readonly=True)
#api.model
def create(self, vals):
obj_visita = self.pool.get('itriplee.servicio')
obj = self.env['itriplee.garantias']
cliente = obj.cliente.id
fecha_compra = obj.fecha_de_venta
fm = ('%Y-%m-%d')
cantidad_meses = 6
ind = 0
now = datetime.now()
now_str = now.strftime(fm)
now_int = datetime.strptime(now_str, fm)
# fecha_compra_original = datetime.strptime(fecha_compra, fm)
fecha_compra_inicial = datetime.strptime(fecha_compra, fm)
while ind < cantidad_meses:
fecha_6_meses = fecha_compra_inicial + relativedelta(months=6)
if fecha_6_meses >= now_int:
obj_visita.create({'cliente':cliente,'visita':fecha_6_meses,'estado':'confirmar','visitas':obj.id},context=None)
ind = ind + 1
fecha_compra_inicial = fecha_6_meses
return True
and get this error:
Traceback (most recent call last):
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 651, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/openerp/odoo-dev/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 693, in dispatch
result = self._call_function(**self.params)
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/openerp/odoo-dev/odoo/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 937, in __call__
return self.method(*args, **kw)
File "/home/openerp/odoo-dev/odoo/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/home/openerp/odoo-dev/odoo/addons/web/controllers/main.py", line 934, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/openerp/odoo-dev/odoo/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/openerp/odoo-dev/odoo/odoo/api.py", line 687, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/home/openerp/odoo-dev/odoo/odoo/api.py", line 672, in call_kw_model
result = method(recs, *args, **kwargs)
File "/home/openerp/odoo-dev/odoo/addons/itriplee/models/garantias.py", line 53, in create
fecha_compra_inicial = datetime.strptime(fecha_compra, fm).date()
TypeError: strptime() argument 1 must be str, not bool
This error occurs when that field is not date string or it contains null value, so it returns False value when it is called.So first make sure that field contains date str when function is called.strptime method requires date string value.
You can use if condition to check whether data is present in field continue strptime method or if you're using pycharm you can add breakpoint to check values
So far i had read many questions but i am sure that i am total a mix up because i am unable understand how to use Search at odoo TransientModel.
I had written a code that get Active_ids from self
context=self.env.context.get('active_ids')
I am supposing these actives_ids as
product_tmpl_id but when i tried to use them
product_recs = produtc_obj.search([('product_tmpl_id', 'in', context)])
print(product_recs)
result = {}
for rec in product_recs:
print(rec.default_code )
result[rec.default_code ]
but its always return
result[rec.default_code ]
KeyError: '1'
Here is my full code
import logging
from odoo import models, fields, api
from odoo.exceptions import Warning
_logger = logging.getLogger(__name__)
class product_export_to_rakuten(models.TransientModel):
_name = 'rakuten_ftp.export_product'
#api.multi
def export_products(self):
# check for more than one orders.
# print(self.env)
context=self.env.context.get('active_ids')
produtc_obj = self.env['product.product']
product_recs = produtc_obj.search([('product_tmpl_id', 'in', context)])
print(product_recs)
result = {}
for rec in product_recs:
print(rec.default_code )
result[rec.default_code ]
Here is the Error
Traceback (most recent call last):
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 647, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "C:/Odoo_Source_Codes/odoo11\odoo\tools\pycompat.py", line 87, in reraise
raise value
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 689, in dispatch
result = self._call_function(**self.params)
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:/Odoo_Source_Codes/odoo11\odoo\service\model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 332, in checked_call
result = self.endpoint(*a, **kw)
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 933, in __call__
return self.method(*args, **kw)
File "C:/Odoo_Source_Codes/odoo11\odoo\http.py", line 512, in response_wrap
response = f(*args, **kw)
File "C:\Odoo_Source_Codes\odoo11\addons\web\controllers\main.py", line 934, in call_button
action = self._call_kw(model, method, args, {})
File "C:\Odoo_Source_Codes\odoo11\addons\web\controllers\main.py", line 922, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "C:/Odoo_Source_Codes/odoo11\odoo\api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "C:/Odoo_Source_Codes/odoo11\odoo\api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "C:\Odoo_Source_Codes\odoo11\custom_addons\rakuten_ftp\wizard\export_product.py", line 22, in export_products
result[rec.default_code ]
KeyError: '1'
Everything seems to be fine with the Transient Model, the problem is that you're trying to read a dictionary value whose key doesn't exist yet. I mean, the default_code of the first product you get in the loop is 1, and you're telling Python: I want to read the value of the key 1 of the dictionary result, but this one is empty, so you get the error (you need to fill it in first).
You can reply the error in a Python console, this is what is happening to you:
>>> result = {}
>>> result['1']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '1'
You should do something like this to make it work:
>>> result = {}
>>> result['1'] = 'Your value' # result.update({'1': 'Your value', })
>>> result['1']
'Your value'
I'm migrating some modules from v7 to v10 of Odoo community version.
Right now, I've modified this method, it looks like this:
class ResPartner(models.Model):
_inherit = 'res.partner'
#api.multi
#api.depends('company_id')
def _get_country_code(self):
"""
Return the country code of the user company. If not exists, return XX.
"""
context = dict(self._context or {})
user_company = self.env['res.users'].browse(company_id)
return user_company.partner_id and user_company.partner_id.country_id \
and user_company.partner_id.country_id.code or 'XX'
But every time I try to go to a res.partner view, it throws me this error:
Odoo Server Error
Traceback (most recent call last):
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 675, in dispatch
result = self._call_function(**self.params)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/service/model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 324, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 504, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 862, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 854, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 681, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 672, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/models.py", line 2995, in read
values[name] = field.convert_to_read(record[name], record, use_name_get)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/models.py", line 5171, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/fields.py", line 860, in __get__
self.determine_value(record)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/fields.py", line 969, in determine_value
self.compute_value(recs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/fields.py", line 924, in compute_value
self._compute_value(records)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/fields.py", line 918, in _compute_value
self.compute(records)
File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/model/partner.py", line 72, in _get_uid_country
res = {}.fromkeys(self._get_country_code())
File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/model/partner.py", line 51, in _get_country_code
user_company = self.env['res.users'].browse(company_id)
NameError: global name 'company_id' is not defined
I'm new into v10 API
Any ideas?
It's give you following error:
ValueError: Expected singleton: res.partner(1, 33, 8, 18, 22, 23)'
I think, you have added field in list/tree view. As per your current code, you didn't iterate record-sets.
If you want to keep your original code with improvements self.company_id then we should remove field from list/tree view. Other then you can move forward with my answer. It will work fine.
Try with following code:
#api.depends('company_id')
def _get_country_code(self):
"""
Return the country code of the user company. If not exists, return XX.
"""
context = dict(self._context or {})
for partner in self:
user_company = self.env['res.company'].browse(self.company_id)
#NOTE: replace code name with your real field name where you want to see value
partner.code = user_company.partner_id and user_company.partner_id.country_id \
and user_company.partner_id.country_id.code or 'XX'
You need to access company_id as a member
user_company = self.env['res.users'].browse(self.company_id)
#NeoVe,
but now it says 'raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: res.partner(1, 33, 8, 18, 22, 23)' :/ Do You know why please?
you can try adding #api.one or #api.model decorator instead of #api.multi for the function declaration.