[FIX] account: properly manage multi currencies in invoices' outstanding payments
Before that, having a payment with amount_residual=0, but amount_residual_currency!=0 did not display it. Also, 'outstanding credits/debits' label was displayed in case amount_residual was != 0 with an amount_currency=0 (and of course, a currency_id value was set on the aml). This could for example happen in case of partial reconciliation, were the amount_residual field is used to keep track of what will have to be written in the exchange rate difference entry when the reconciliation becomes full. closes odoo/odoo#30362
This commit is contained in:
@@ -111,7 +111,12 @@ class AccountInvoice(models.Model):
|
||||
def _get_outstanding_info_JSON(self):
|
||||
self.outstanding_credits_debits_widget = json.dumps(False)
|
||||
if self.state == 'open':
|
||||
domain = [('account_id', '=', self.account_id.id), ('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id), ('reconciled', '=', False), ('amount_residual', '!=', 0.0)]
|
||||
domain = [('account_id', '=', self.account_id.id),
|
||||
('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id),
|
||||
('reconciled', '=', False),
|
||||
'|',
|
||||
'&', ('amount_residual_currency', '!=', 0.0), ('currency_id','!=', None),
|
||||
'&', ('amount_residual_currency', '=', 0.0), '&', ('currency_id','=', None), ('amount_residual', '!=', 0.0)]
|
||||
if self.type in ('out_invoice', 'in_refund'):
|
||||
domain.extend([('credit', '>', 0), ('debit', '=', 0)])
|
||||
type_payment = _('Outstanding credits')
|
||||
|
||||
Reference in New Issue
Block a user