Skip to Content
Menu
This question has been flagged
1 Reply
9593 Views

Good afternoon community Odoo. I have a problem trying to save a shipping address within a contact in Odoo Version 12. The error is as follows:

Error:
Odoo Server Error

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 962, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "", line 2, in write
File "/usr/lib/python3/dist-packages/odoo/api.py", line 372, in loop
result = [method(rec, *args, **kwargs) for rec in self]
File "/usr/lib/python3/dist-packages/odoo/api.py", line 372, in
result = [method(rec, *args, **kwargs) for rec in self]
File "/usr/lib/python3/dist-packages/odoo/addons/acoim_facturacion/models/res_partner.py", line 37, in write
return super(ResPartner, self).write(vals)
File "/usr/lib/python3/dist-packages/odoo/addons/partner_autocomplete/models/res_partner.py", line 183, in write
res = super(ResPartner, self).write(values)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/res_partner.py", line 537, in write
result = result and super(Partner, self).write(vals)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 322, in write
result = super(MailThread, self).write(values)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_activity.py", line 575, in write
return super(MailActivityMixin, self).write(vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3284, in write
self._write(store_vals)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3424, in _write
field.write(other, vals[field.name])
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2521, in write
flush()
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2482, in flush
comodel.create(vals_list)
File "", line 2, in create
File "/usr/lib/python3/dist-packages/odoo/api.py", line 433, in _model_create_single
return self.browse().concat(*(create(self, vals) for vals in arg))
File "/usr/lib/python3/dist-packages/odoo/api.py", line 433, in
return self.browse().concat(*(create(self, vals) for vals in arg))
File "/usr/lib/python3/dist-packages/odoo/addons/acoim_facturacion/models/res_partner.py", line 25, in create
vals['email'] = vals.get('name') + '@demo.com'
TypeError: unsupported operand type(s) for +: 'bool' and 'str'


Beforehand thank you very much.



Avatar
Discard
Best Answer

Hi frxnco,

You're getting this traceback because the custom module 'acoim_facturaction' that you use has an issue.
In this module there is a line of code (models/res_partner.py line 25) where the code tries to set the name before @demo.com.
However, if the name is empty Python will return "False", causing an operand type error.
You can prevent this by first checking if there is a name:

if vals.get('name'):
    vals['email'] = vals.get('name') + '@demo.com'

Regards,
Yenthe

Avatar
Discard
Related Posts Replies Views Activity
2
Aug 19
4293
1
Oct 24
187
0
Dec 23
650
2
May 23
2094
3
Sep 21
10605