Skip to content

Commit

Permalink
[IMP] Add ecotax amounts in invoice report
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-dacosta committed Nov 25, 2024
1 parent 7e230c6 commit 40068e1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
1 change: 1 addition & 0 deletions account_ecotax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"views/account_move_view.xml",
"views/product_template_view.xml",
"views/product_view.xml",
"report/invoice.xml",
],
"installable": True,
}
4 changes: 4 additions & 0 deletions account_ecotax/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ def _get_tax_totals(
)
res["groups_by_subtotal"][_("Untaxed Amount")] = data
return res

Check warning on line 61 in account_ecotax/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_ecotax/models/account_move.py#L60-L61

Added lines #L60 - L61 were not covered by tests

def _get_formatted_ecotax_amount(self):
self.ensure_one()
return formatLang(self.env, self.amount_ecotax, currency_obj=self.currency_id)

Check warning on line 65 in account_ecotax/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_ecotax/models/account_move.py#L64-L65

Added lines #L64 - L65 were not covered by tests
46 changes: 46 additions & 0 deletions account_ecotax/report/invoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_invoice_document"
inherit_id="account.report_invoice_document"
priority="100"
>
<xpath expr="//th[@name='th_price_unit']" position="after">
<th
name="th_ecotax"
t-if="o.amount_ecotax"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
>
<span>Eco Part Unit</span>
</th>
</xpath>
<xpath expr="//td[span[@t-field='line.discount']]" position="after">
<td
t-if="o.amount_ecotax"
t-attf-class="text-center {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
>
<span
class="text-nowrap"
t-field="line.ecotax_amount_unit"
/>
</td>
</xpath>
</template>

<template
id="document_tax_totals"
inherit_id="account.document_tax_totals"
priority="100"
>
<xpath expr="//t[@t-set='subtotal_to_show']" position="before">
<tr t-if="o.amount_ecotax">
<td>Dont Eco Part HT</td>
<td class="text-end">
<span
t-esc="o._get_formatted_ecotax_amount()"
/>
</td>
</tr>
</xpath>
</template>
</odoo>
8 changes: 6 additions & 2 deletions account_ecotax/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@
<field name="name" widget="text" readonly="1" />
<notebook>
<page string="Ecotaxe lines" name="ecotax_line">
<field name="ecotax_line_ids" nolabel="1" readonly="1">
<field
name="ecotax_line_ids"
nolabel="1"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}"
>
<tree editable="bottom">
<field name="classification_id" />
<field name="force_amount_unit" readonly="1" />
<field name="force_amount_unit" />
<field name="amount_unit" />
<field
name="amount_total"
Expand Down

0 comments on commit 40068e1

Please sign in to comment.