From 5097b86ee2fbd4c99acc1e41b310b236f30d09e1 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 8 Sep 2023 11:15:07 +0200 Subject: [PATCH] l10n_fr_account_vat_return: improve notes Remove field origin_move_partner_id from log lines --- .../models/l10n_fr_account_vat_return.py | 32 ++++++++++--------- .../views/l10n_fr_account_vat_return.xml | 18 ++--------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py b/l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py index 23c165c1fb..7bb4eca0b6 100644 --- a/l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py +++ b/l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py @@ -998,7 +998,9 @@ def _generate_due_vat_autoliq(self, speedy, type_rate2logs): continue ptype = "autoliq_%s_%s" % (autoliq_type, ps_type) # Block B - vat_note = _("VAT amount %s, %s ratio %.2f%%, %s VAT amount %s") % ( + vat_note = _( + "VAT amount %s, %s ratio %.2f%% → %s VAT amount %s" + ) % ( format_amount(self.env, total_vat_amount, speedy["currency"]), ps_labels[ps_type], ratio[ps_type], @@ -1287,8 +1289,9 @@ def _generate_due_vat_monaco(self, speedy, sale_vat_accounts): "compute_type": "computed_vat_amount", "amount": vat_amount, "origin_move_id": mline.move_id.id, - "note": _("Monaco customer '%s', VAT amount %s") + "note": _("%s partner %s from Monaco, VAT amount %s") % ( + mline.move_id.name, mline.partner_id.display_name, format_amount(self.env, vat_amount, speedy["currency"]), ), @@ -1387,9 +1390,11 @@ def _vat_on_payment(self, in_or_out, vat_account_ids, speedy): lambda x: not x.display_type and x.account_id.id in vat_account_ids ): amount = speedy["currency"].round(line.balance) * vat_sign - note = _( - "Invoice/refund is unpaid, Unpaid VAT amount %s" - ) % format_amount(self.env, amount, speedy["currency"]) + note = _("%s (%s) is unpaid, Unpaid VAT amount %s") % ( + unpaid_inv.name, + unpaid_inv.commercial_partner_id.display_name, + format_amount(self.env, amount, speedy["currency"]), + ) account2logs[line.account_id].append( { "note": note, @@ -1458,19 +1463,21 @@ def _vat_on_payment(self, in_or_out, vat_account_ids, speedy): balance = line.balance * vat_sign if fully_unpaid: amount = speedy["currency"].round(balance) - note = _( - "Invoice/refund was unpaid on %s, Unpaid VAT amount %s" - ) % ( + note = _("%s (%s) was unpaid on %s, Unpaid VAT amount %s") % ( + move.name, + move.commercial_partner_id.display_name, speedy["end_date_formatted"], format_amount(self.env, amount, speedy["currency"]), ) else: amount = speedy["currency"].round(balance * unpaid_ratio) note = _( - "%d%% of the invoice/refund was unpaid on %s, " - "VAT amount %s => Unpaid VAT amount %s" + "%d%% of %s (%s) was unpaid on %s, " + "VAT amount %s → Unpaid VAT amount %s" ) % ( int(round(unpaid_ratio * 100)), + move.name, + move.commercial_partner_id.display_name, speedy["end_date_formatted"], format_amount(self.env, balance, speedy["currency"]), format_amount(self.env, amount, speedy["currency"]), @@ -2284,11 +2291,6 @@ class L10nFrAccountVatReturnLineLog(models.Model): origin_move_id = fields.Many2one( "account.move", string="Source Invoice", readonly=True ) - origin_move_partner_id = fields.Many2one( - related="origin_move_id.commercial_partner_id", - string="Source Invoice Partner", - store=True, - ) note = fields.Char() @api.constrains("parent_id", "account_id", "compute_type") diff --git a/l10n_fr_account_vat_return/views/l10n_fr_account_vat_return.xml b/l10n_fr_account_vat_return/views/l10n_fr_account_vat_return.xml index 9d2bf0b017..d26160249a 100644 --- a/l10n_fr_account_vat_return/views/l10n_fr_account_vat_return.xml +++ b/l10n_fr_account_vat_return/views/l10n_fr_account_vat_return.xml @@ -404,22 +404,14 @@ name="parent_id" invisible="not context.get('l10n_fr_account_vat_return_line_log_main_view')" /> + - - - @@ -438,20 +430,16 @@ name="parent_id" invisible="not context.get('l10n_fr_account_vat_return_line_log_main_view')" /> + - -