Skip to content
Snippets Groups Projects
Commit 421bbcd5 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] l10n_ch: ISR with partial payment


- Create an invoice for 1000
- Make a partial payment (e.g. cash) for 250
- Print the ISR

The ISR contains an amount of 1000 (total amount), while it should be
750 (amount left to pay).

opw-2180538

closes odoo/odoo#44518

X-original-commit: 7ec5e1d6
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 8579c0ca
Branches
Tags
No related merge requests found
......@@ -102,7 +102,7 @@ class AccountMove(models.Model):
@api.depends(
'currency_id.name', 'amount_total', 'name',
'currency_id.name', 'amount_residual', 'name',
'invoice_partner_bank_id.l10n_ch_postal',
'invoice_partner_bank_id.l10n_ch_isr_subscription_eur',
'invoice_partner_bank_id.l10n_ch_isr_subscription_chf')
......@@ -132,7 +132,7 @@ class AccountMove(models.Model):
currency_code = '01'
elif record.currency_id.name == 'EUR':
currency_code = '03'
units, cents = float_split_str(record.amount_total, 2)
units, cents = float_split_str(record.amount_residual, 2)
amount_to_display = units + cents
amount_ref = amount_to_display.zfill(10)
left = currency_code + amount_ref
......@@ -163,7 +163,7 @@ class AccountMove(models.Model):
This function is needed on the model, as it must be called in the report
template, which cannot reference static functions
"""
return float_split_str(self.amount_total, 2)
return float_split_str(self.amount_residual, 2)
def display_swiss_qr_code(self):
""" Trigger the print of the Swiss QR code in the invoice report or not
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment