Thursday, September 19, 2024
2 changes · saas-17.2
Resolved issues and error corrections
The employee appraisal screen now handles archived appraisals without showing an error. This prevents users from hitting a traceback when opening the Ongoing Appraisal button after an appraisal has been archived.
Original PR description
When the Appraisal of employee is archived and a user clicks on the Ongoing Appraisal button, a traceback will appear. Steps to reproduce the error: - Install ```hr_appraisal``` module - Create new…
When the Appraisal of employee is archived and a user clicks on
the Ongoing Appraisal button, a traceback will appear.
Steps to reproduce the error:
- Install ```hr_appraisal``` module
- Create new employee > Click Request Appraisal > Save Appraisal >
Archive that Appraisal
- Go back to employee > Click on ```Ongoing Appraisal``` button
Traceback:
```
Traceback (most recent call last):
File "/home/odoo/odoo/community/odoo/http.py", line 2267, in __call__
response = request._serve_db()
File "/home/odoo/odoo/community/odoo/http.py", line 1842, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "/home/odoo/odoo/community/odoo/http.py", line 1862, in _transactioning
return service_model.retrying(func, env=self.env)
File "/home/odoo/odoo/community/odoo/service/model.py", line 134, in retrying
result = func()
File "/home/odoo/odoo/community/odoo/http.py", line 1840, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "/home/odoo/odoo/community/odoo/http.py", line 1847, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/odoo/community/odoo/http.py", line 2072, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/home/odoo/odoo/community/odoo/addons/base/models/ir_http.py", line 220, in _dispatch
result = endpoint(**request.params)
File "/home/odoo/odoo/community/odoo/http.py", line 774, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/home/odoo/odoo/community/addons/web/controllers/dataset.py", line 42, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/odoo/odoo/community/addons/web/controllers/dataset.py", line 34, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/odoo/community/odoo/api.py", line 458, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "/home/odoo/odoo/enterprise/hr_appraisal/models/hr_employee_base.py", line 39, in action_open_last_appraisal
if len(relevant_appraisals) == 1:
UnboundLocalError: local variable 'relevant_appraisals' referenced before assignment
```
https://github.com/odoo/enterprise/blob/a9a3ece5c8ae5fa0b2fa117acb5dbedc69689478/hr_appraisal/models/hr_employee_base.py#L30-L37
When appraisal is archived, ```employee_appraisals``` will be empty,
So, eventually ```relevant_appraisals``` will be Empty.
So, it will lead to the above traceback.
sentry-5830582533This fixes an issue where loading Argentine localization demo data after database setup could fail because some sample products received duplicate default taxes. The affected demo products are now tied to the correct company, preventing errors when sample invoices or accounting entries are created.
Original PR description
### Steps to reproduce: - Create a db with `l10n_ar` but without demo data - In dev move at the bottom of the settings page: Load Demo data #### > UserError > load aborted. ### Cause of the issue:…
### Steps to reproduce: - Create a db with `l10n_ar` but without demo data - In dev move at the bottom of the settings page: Load Demo data #### > UserError > load aborted. ### Cause of the issue: Since commit 051d43dbef390de171307fe0e493d651c9ad7b4b (17.0), during the create of products, if the product is not associated to a given company, we add a default tax for each company that is not in the context (and hence should not have defined a tax yet): https://github.com/odoo/odoo/blob/b32fc0f715e41f6795972f2f8a2c3e4826357aa1/addons/account/models/product.py#L138-L146 However, if you were to create a DB without demo data and if you were loading the demo data from the UI, you will create demo datas product for companies that had already set a tax for that product (e.g. `company_ri` on the product `product_product_telefonia`) and since the current company is in the context the override of the create will add a second tax on these products for that companies. As such, if the product is later used in account moves it will raise a user error: https://github.com/odoo/odoo/blob/b32fc0f715e41f6795972f2f8a2c3e4826357aa1/addons/l10n_ar/models/account_move.py#L141-L144 and the installation of the all the demo datas will then be aborted. ### Fix: Since the demo data's products used in the account moves raising user errors are only expected to be used in the the company for which we have associated a tax eg: https://github.com/odoo/odoo/blob/b32fc0f715e41f6795972f2f8a2c3e4826357aa1/addons/l10n_ar/demo/account_supplier_invoice_demo.xml#L136 we simply add a company_id on these products. Note that the test datas had to be updated in somewhat a similar way in commit 051d43dbef390de171307fe0e493d651c9ad7b4b. opw-4180872 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr