OCA / brand

Manage brands for products and companies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing dependency in sale_brand?

cubells opened this issue · comments

Odoo 15.0 completely updated.

Due to this line:

https://github.com/OCA/brand/blob/15.0/sale_brand/models/res_brand.py#L34

An error is raised on create a brand because module website is not installled.

This is the log:

Traceback (most recent call last):
File "/opt/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/opt/odoo/src/odoo/odoo/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/src/odoo/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/src/odoo/odoo/http.py", line 916, in call
return self.method(*args, **kw)
File "/opt/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/src/odoo/addons/web/controllers/main.py", line 1342, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/src/odoo/addons/web/controllers/main.py", line 1334, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/src/odoo/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/src/odoo/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/src/odoo/odoo/models.py", line 6480, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "/opt/odoo/src/odoo/odoo/models.py", line 6213, in _onchange_eval
method_res = method(self)
File "/opt/odoo/src/other-addons/sale_brand/models/res_brand.py", line 34, in _compute_terms_url
text = brand.website + brand.terms_page
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: unsupported operand type(s) for +: 'bool' and 'str'

It's not a dependency problem because by installing website module the bug is not avoided.

File "/opt/odoo/src/other-addons/sale_brand/models/res_brand.py", line 34, in _compute_terms_url
text = brand.website + brand.terms_page
Exception
TypeError: unsupported operand type(s) for +: 'bool' and 'str'

one of the two fields is empty (empty in odoo is bool False), this should fix it

text = "%s%s" % (brand.website or "",brand.terms_page or "")

I will push a PR to fix it later

To be closed @cubells ?

@bealdav

Yes, fixed in #140