Skip to content

Commit

Permalink
[IMP] l10n_nl_tax_statement_icp: format BTW code on reports
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Nov 14, 2023
1 parent 0010bab commit 8c097e1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions l10n_nl_tax_statement_icp/models/l10n_nl_vat_statement_icp_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class VatStatementIcpLine(models.Model):
string="VAT",
readonly=True,
)
format_vat = fields.Char(
compute="_compute_format_vat",
)
country_code = fields.Char(
readonly=True,
)
Expand All @@ -32,6 +35,14 @@ class VatStatementIcpLine(models.Model):
amount_services = fields.Monetary(readonly=True)
format_amount_services = fields.Char(compute="_compute_icp_amount_format")

@api.depends("vat", "country_code")
def _compute_format_vat(self):
for line in self:
if line.country_code and line.vat:
line.format_vat = line.vat.lstrip(line.country_code)

Check warning on line 42 in l10n_nl_tax_statement_icp/models/l10n_nl_vat_statement_icp_line.py

View check run for this annotation

Codecov / codecov/patch

l10n_nl_tax_statement_icp/models/l10n_nl_vat_statement_icp_line.py#L42

Added line #L42 was not covered by tests
else:
line.format_vat = line.format_vat

@api.depends("amount_products", "amount_services")
def _compute_icp_amount_format(self):
for line in self:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def _get_report_columns(self):
"""Define the report columns used to generate report"""
return {
0: {"header": _("Partner"), "field": "partner_name", "width": 60},
1: {"header": _("VAT"), "field": "vat", "width": 50},
2: {"header": _("Country Code"), "field": "country_code", "width": 14},
1: {"header": _("Country Code"), "field": "country_code", "width": 14},
2: {"header": _("VAT"), "field": "format_vat", "width": 50},
3: {"header": _("Currency"), "field": "currency_name", "width": 14},
4: {"header": _("Amount Product"), "field": "amount_products", "width": 20},
5: {"header": _("Amount Service"), "field": "amount_services", "width": 20},
Expand Down
6 changes: 3 additions & 3 deletions l10n_nl_tax_statement_icp/report/report_tax_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
>
<div class="nl_tax_act_as_row labels">
<div class="nl_tax_act_as_cell left">Partner</div>
<div class="nl_tax_act_as_cell left">VAT</div>
<div class="nl_tax_act_as_cell left">Country Code</div>
<div class="nl_tax_act_as_cell left">VAT</div>
<div class="nl_tax_act_as_cell right">Currency</div>
<div
class="nl_tax_act_as_cell right"
Expand All @@ -48,10 +48,10 @@
<span t-field="line.partner_id" />
</div>
<div class="nl_tax_act_as_cell left">
<span t-field="line.vat" />
<span t-field="line.country_code" />
</div>
<div class="nl_tax_act_as_cell left">
<span t-field="line.country_code" />
<span t-field="line.format_vat" />
</div>
<div class="nl_tax_act_as_cell right">
<span t-field="line.currency_id" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<field name="icp_line_ids">
<tree editable="bottom" create="false" delete="false">
<field name="partner_id" />
<field name="vat" />
<field name="country_code" />
<field name="format_vat" />
<field name="currency_id" />
<field name="amount_products" />
<field name="amount_services" />
Expand Down

0 comments on commit 8c097e1

Please sign in to comment.