-
-
Notifications
You must be signed in to change notification settings - Fork 875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] partner_contact_department: make display name lang-aware #2023
base: 16.0
Are you sure you want to change the base?
Conversation
1ca4276
to
fccc715
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an error with the creation of the department with the last entered change of the display_name.
Traceback (most recent call last):
File "/opt/odoo/odoo/http.py", line 1658, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/opt/odoo/odoo/service/model.py", line 152, in retrying
result = func()
File "/opt/odoo/odoo/http.py", line 1686, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/opt/odoo/odoo/http.py", line 1890, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "/opt/odoo/odoo/http.py", line 734, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/addons/web/controllers/dataset.py", line 43, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/addons/web/controllers/dataset.py", line 34, in _call_kw
return call_kw(Model, method, args, kwargs)
File "/opt/odoo/odoo/api.py", line 484, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo/api.py", line 469, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo/models.py", line 6665, in onchange
snapshot1 = Snapshot(record, nametree)
File "/opt/odoo/odoo/models.py", line 6425, in __init__
self.fetch(name)
File "/opt/odoo/odoo/models.py", line 6435, in fetch
self[name] = record[name]
File "/opt/odoo/odoo/models.py", line 5991, in __getitem__
return self._fields[key].__get__(self, self.env.registry[self._name])
File "/opt/odoo/odoo/fields.py", line 1158, in __get__
self.recompute(record)
File "/opt/odoo/odoo/fields.py", line 1382, in recompute
apply_except_missing(self.compute_value, recs)
File "/opt/odoo/odoo/fields.py", line 1355, in apply_except_missing
func(records)
File "/opt/odoo/odoo/fields.py", line 1404, in compute_value
records._compute_field_value(self)
File "/opt/odoo/odoo/models.py", line 4260, in _compute_field_value
fields.determine(field.compute, self)
File "/opt/odoo/odoo/fields.py", line 98, in determine
return needle(*args)
File "/mnt/data/odoo-addons-dir/partner_contact_department/models/res_partner.py", line 37, in _compute_display_name
results[lang] = super(ResPartnerDepartment, _self)._compute_display_name()
File "/opt/odoo/odoo/models.py", line 1546, in _compute_display_name
names = dict(self.name_get())
File "/mnt/data/odoo-addons-dir/partner_contact_department/models/res_partner.py", line 43, in name_get
map(int, "/".join(rec.parent_path.strip("/") for rec in self).split("/"))
File "/mnt/data/odoo-addons-dir/partner_contact_department/models/res_partner.py", line 43, in <genexpr>
map(int, "/".join(rec.parent_path.strip("/") for rec in self).split("/"))
AttributeError: 'bool' object has no attribute 'strip'
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPC_ERROR
at makeErrorFromResponse (http://oca-partner-contact-16-0-pr2023-fccc7151fffd.runboat.odoo-community.org/web/assets/459-60b098f/web.assets_backend.min.js:1002:163)
at XMLHttpRequest.<anonymous> (http://oca-partner-contact-16-0-pr2023-fccc7151fffd.runboat.odoo-community.org/web/assets/459-60b098f/web.assets_backend.min.js:1010:13)
Yet another iteration over OCA#2009. `display_name` wasn't translatable, but `name` was. Thus, stored record order was always on English. Now, if department names are translated and the user switches to another language, the order the user will see will match the language it is displaying. Another fix is that now, when changing a parent department name name, children display names will change too. I took the chance to apply some anti-flaky-tests good practices in current test suite (apart from increasing coverage to cover these new cases). @moduon MT-8760
fccc715
to
49389bb
Compare
Please @fcvalgar review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yajo, Can you check the tests? thank you. |
Yet another iteration over #2009.
display_name
wasn't translatable, butname
was. Thus, stored record order was always on English. Now, if department names are translated and the user switches to another language, the order the user will see will match the language it is displaying.Another fix is that now, when changing a parent department name name, children display names will change too.
I took the chance to apply some anti-flaky-tests good practices in current test suite (apart from increasing coverage to cover these new cases).
@moduon MT-8760