[FIX] account: fix exchange difference currency in the invoice widget
Suppose there is an invoice is issued in a foreign currency, but the statement line only has an amount in the company's currency and the `amount_foreign_currency` is empty. In this case, the exchange difference currency matches the invoice and `amount_foreign_currency` is 0,00, which is shown between the brackets in the pop-up. Brackets should not be shown if the `amount_foreign_currency` is 0. The exchange difference currency should match company currency. closes odoo/odoo#103433 X-original-commit: 8afccc41592d88125ab0f2678399086f83ab308d Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
This commit is contained in:
@@ -1118,12 +1118,16 @@ class AccountMove(models.Model):
|
||||
reconciliation_ref = '%s (%s)' % (counterpart_line.move_id.name, counterpart_line.move_id.ref)
|
||||
else:
|
||||
reconciliation_ref = counterpart_line.move_id.name
|
||||
if counterpart_line.amount_currency and counterpart_line.currency_id != counterpart_line.company_id.currency_id:
|
||||
foreign_currency = counterpart_line.currency_id
|
||||
else:
|
||||
foreign_currency = False
|
||||
|
||||
reconciled_vals.append({
|
||||
'name': counterpart_line.name,
|
||||
'journal_name': counterpart_line.journal_id.name,
|
||||
'amount': reconciled_partial['amount'],
|
||||
'currency_id': reconciled_partial['currency'].id,
|
||||
'currency_id': move.company_id.currency_id.id if reconciled_partial['is_exchange'] else reconciled_partial['currency'].id,
|
||||
'date': counterpart_line.date,
|
||||
'partial_id': reconciled_partial['partial_id'],
|
||||
'account_payment_id': counterpart_line.payment_id.id,
|
||||
@@ -1133,7 +1137,7 @@ class AccountMove(models.Model):
|
||||
# these are necessary for the views to change depending on the values
|
||||
'is_exchange': reconciled_partial['is_exchange'],
|
||||
'amount_company_currency': formatLang(self.env, abs(counterpart_line.balance), currency_obj=counterpart_line.company_id.currency_id),
|
||||
'amount_foreign_currency': formatLang(self.env, abs(counterpart_line.amount_currency), currency_obj=counterpart_line.currency_id) if counterpart_line.currency_id != counterpart_line.company_id.currency_id else False
|
||||
'amount_foreign_currency': foreign_currency and formatLang(self.env, abs(counterpart_line.amount_currency), currency_obj=foreign_currency)
|
||||
})
|
||||
payments_widget_vals['content'] = reconciled_vals
|
||||
|
||||
|
||||
Reference in New Issue
Block a user