Skip to content

Commit

Permalink
[FIX] account_ux: error al hacer un cobro con third party check.
Browse files Browse the repository at this point in the history
Task: 35205
Al hacer un cobro de una factura de cliente desde el botón para cobrar "Register payment" desde la vista formulario de la factura, si se elige diario "Third party checks" para hacer el cobro entonces surge un error:

Video replicando el error en runbot adhoc de versión 17 (29/11/2023):
https://drive.google.com/file/d/15BJmMRyvsrrMvSG8CKJ-x74h0BB3qW-6/view
  • Loading branch information
pablohmontenegro committed Dec 4, 2023
1 parent 9681a92 commit 8e6db2c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions account_ux/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,34 @@ def get_accounting_rate(vals):
else:
return abs(vals['amount_currency']) / abs(vals['balance'])

company_currency = debit_values['company'].currency_id
reconcile_on_company_currency = debit_values['company'].reconcile_on_company_currency and \
(debit_values['currency'] != company_currency or credit_values['currency'] != company_currency) and \
not debit_values['record'].account_id.currency_id
company_debit_currency = debit_values['aml'].company_currency_id
company_credit_currency = credit_values['aml'].company_currency_id
reconcile_on_company_currency = debit_values['aml'].company_id.reconcile_on_company_currency and \
(debit_values['aml'].currency_id != company_debit_currency or credit_values['aml'].currency_id != company_credit_currency) and \
not debit_values['aml'].account_id.currency_id
if reconcile_on_company_currency:
if debit_values['currency'] != debit_values['company'].currency_id:
debit_values['original_currency'] = debit_values['currency']
if debit_values['aml'].currency_id != company_debit_currency:
debit_values['original_currency'] = debit_values['aml'].currency_id
debit_values['original_amount_residual_currency'] = debit_values['amount_residual_currency']
debit_values['currency'] = debit_values['company'].currency_id
debit_values['aml'].currency_id = company_debit_currency
debit_values['amount_residual_currency'] = debit_values['amount_residual']
if credit_values['currency'] != credit_values['company'].currency_id:
credit_values['original_currency'] = credit_values['currency']
if credit_values['aml'].currency_id != company_credit_currency:
credit_values['original_currency'] = credit_values['aml'].currency_id
credit_values['original_amount_residual_currency'] = credit_values['amount_residual_currency']
credit_values['currency'] = credit_values['company'].currency_id
credit_values['aml'].currency_id = company_credit_currency
credit_values['amount_residual_currency'] = credit_values['amount_residual']
res = super()._prepare_reconciliation_single_partial(debit_values, credit_values, shadowed_aml_values)

if reconcile_on_company_currency and 'partial_vals' in res:
if 'original_currency' in credit_values:
credit_values['currency'] = credit_values['original_currency']
credit_values['aml'].currency_id = credit_values['original_currency']
rate = get_accounting_rate(credit_values)
res['partial_vals']['credit_amount_currency'] = credit_values['currency'].round(
res['partial_vals']['credit_amount_currency'] = credit_values['aml'].currency_id.round(
res['partial_vals']['credit_amount_currency'] * rate)
if 'original_currency' in debit_values:
debit_values['currency'] = debit_values['original_currency']
debit_values['aml'].currency_id = debit_values['original_currency']
rate = get_accounting_rate(debit_values)
res['partial_vals']['debit_amount_currency'] = credit_values['currency'].round(
res['partial_vals']['debit_amount_currency'] = credit_values['aml'].currency_id.round(
res['partial_vals']['debit_amount_currency'] * rate)
return res

Expand Down

0 comments on commit 8e6db2c

Please sign in to comment.