Encountered an issue when creating a new line on a payment order, resulting in the following error:
ValueError: too many values to unpack (expected 2)
This error is triggered when the apply_retention
function from the retention.tax.application
model is called within the compute_advance_payment_retentions
function.
base, amount = taxapp.apply_retention(
self.partner_id,
ret_vals.get('percent'),
ret_vals.get('excluded_percent'),
vals,
self.date,
)
However, the apply_retention function returns three values:
return (
base * sign_base,
amount * sign_base,
payment_order_base * sign_base,
)
Detailed traceback
File "/opt/odoo/custom/src/odoo/odoo/models.py", line 6507, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "/opt/odoo/custom/src/odoo/odoo/models.py", line 6240, in _onchange_eval
method_res = method(self)
File "/opt/odoo/auto/addons/l10n_ar_eynes/models/account_payment_order.py", line 900, in onchange_payment_line
amount = self.payment_order_amount_hook()
File "/opt/odoo/auto/addons/l10n_ar_eynes/models/account_payment_order.py", line 445, in payment_order_amount_hook
amount += self.compute_advance_payment_retentions(amount)
File "/opt/odoo/auto/addons/l10n_ar_eynes/models/account_payment_order.py", line 513, in compute_advance_payment_retentions
base, amount = taxapp.apply_retention(
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: too many values to unpack (expected 2)