Daily updates from Odoo
Wednesday, August 7, 2024
2 changes · 17.0
Resolved issues and error corrections
This fix resolves a system crash that occurred when the Chilean EDI authentication token was invalid or missing. The system was only checking for one type of invalid token (None) but not handling other invalid cases, causing automated workflows to fail. This update ensures the system properly handles all invalid token scenarios and prevents the crash.
Original PR description
Currently, a traceback may occur when we get the token as false Error:- ``` TypeError: can only concatenate str (not "bool") to str File "odoo/tools/safe_eval.py", line 390, in safe_eval return…
Currently, a traceback may occur when we get the token as false
Error:-
```
TypeError: can only concatenate str (not "bool") to str
File "odoo/tools/safe_eval.py", line 390, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(348,)", line 1, in <module>
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi_stock/models/account_move.py", line 14, in cron_run_sii_workflow
super(AccountMove, self).cron_run_sii_workflow()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 806, in cron_run_sii_workflow
self_skip._l10n_cl_ask_claim_status()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 780, in _l10n_cl_ask_claim_status
move.l10n_cl_verify_claim_status()
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/account_move.py", line 288, in l10n_cl_verify_claim_status
response = self._get_dte_claim(
File "home/odoo/src/enterprise/saas-17.2/l10n_cl_edi/models/l10n_cl_edi_util.py", line 408, in _get_dte_claim
settings = Settings(strict=False, extra_http_headers={'Cookie': 'TOKEN=' + token})
ValueError: <class 'TypeError'>: "can only concatenate str (not "bool") to str" while evaluating
'model.cron_run_sii_workflow()'
File "odoo/addons/base/models/ir_cron.py", line 388, in _callback
self.env['ir.actions.server'].browse(server_action_id).run()
File "home/odoo/src/custom/trial/saas_trial/models/sentry.py", line 33, in run
res = super().run()
File "odoo/addons/base/models/ir_actions.py", line 971, in run
res = runner(run_self, eval_context=eval_context)
File "addons/website/models/ir_actions_server.py", line 61, in _run_action_code_multi
res = super(ServerAction, self)._run_action_code_multi(eval_context)
File "odoo/addons/base/models/ir_actions.py", line 801, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self)) # nocopy allows to return 'action'
File "odoo/tools/safe_eval.py", line 404, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
```
But here in the code, only the None case was handled. https://github.com/odoo/enterprise/blob/5dae45bea35b55e88e1d7199a555f9cc5375c899/l10n_cl_edi/models/l10n_cl_edi_util.py#L407-L410
After applying this commit it will resolve this issue by handling all the falsy cases for the token.
sentry-5539925394
Forward-Port-Of: odoo/enterprise#66232This fix resolves an issue in the Profit & Loss report that occurred when using negative analytical account percentages. When grouping by analytical accounts in the P&L report, the system was incorrectly validating amounts and causing errors. The fix removes an overly strict validation constraint from the temporary reporting table to allow proper handling of negative analytical distributions.
Original PR description
Problem: An issue arises due to a negative analytical distribution. If the analytical percentage is negative, its sign will match the sign of the amount_currency of its move line. However, in the…
Problem: An issue arises due to a negative analytical distribution. If the analytical percentage is negative, its sign will match the sign of the amount_currency of its move line. However, in the query that groups by the analytical account for P&L, the amount value is inverted. This does not cause a problem when the analytic percentage is positive because the amount_currency sign is opposite to the sign of the analytic line amount. But, in cases where the sign is the same, there will be a balance with a different sign than the amount, which will not comply with the constraint of the account.move.line table: "account_move_line_check_amount_currency_balance_sign". Steps to reproduce: 1. Activate "Analytic Accounting" in the settings 2. In an invoice, set an analytic distribution with a negative percentage 3. Validate the invoice 4. Go to P&L report an try to group by an analytic account 5. A validation error will occur. Proposed solution: Remove the constraint in the temporary table. opw-4092475 opw-4092232 opw-4086515 opw-4084850 opw-4083077 Forward-Port-Of: odoo/enterprise#67953