Skip to content

Commit

Permalink
l10n_fr_account_vat_return: improve notes
Browse files Browse the repository at this point in the history
Remove field origin_move_partner_id from log lines
  • Loading branch information
alexis-via committed Sep 8, 2023
1 parent cd1db45 commit 5097b86
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
32 changes: 17 additions & 15 deletions l10n_fr_account_vat_return/models/l10n_fr_account_vat_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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"]),
),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"]),
Expand Down Expand Up @@ -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")
Expand Down
18 changes: 3 additions & 15 deletions l10n_fr_account_vat_return/views/l10n_fr_account_vat_return.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,22 +404,14 @@
name="parent_id"
invisible="not context.get('l10n_fr_account_vat_return_line_log_main_view')"
/>
<field name="compute_type" />
<field name="account_id" />
<field name="amount" sum="1" />
<field name="compute_type" />
<field
name="origin_move_id"
optional="show"
/>
<field
name="origin_move_partner_id"
optional="hide"
/>
<field name="note" optional="show" />
<field
name="analytic_account_id"
groups="analytic.group_analytic_accounting"
optional="show"
optional="hide"
attrs="{'column_invisible': [('parent.box_accounting_method', '=', False)]}"
/>
</tree>
Expand All @@ -438,20 +430,16 @@
name="parent_id"
invisible="not context.get('l10n_fr_account_vat_return_line_log_main_view')"
/>
<field name="compute_type" />
<field name="account_id" />
<field
name="analytic_account_id"
groups="analytic.group_analytic_accounting"
/>
<field name="amount" />
<field name="compute_type" />
<field
name="origin_move_id"
attrs="{'invisible': [('origin_move_id', '=', False)]}"
/>
<field
name="origin_move_partner_id"
attrs="{'invisible': [('origin_move_id', '=', False)]}"
/>
</group>
<group string="Notes">
Expand Down

0 comments on commit 5097b86

Please sign in to comment.