Skip to content

Commit

Permalink
Merge pull request #99 from dhongu/15.0-invoice-report-sections
Browse files Browse the repository at this point in the history
[15.0][UPD]invoice report: added sections and subtotals
  • Loading branch information
danila12 authored Oct 19, 2023
2 parents 415bdea + 1b55d78 commit 37d9041
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
8 changes: 5 additions & 3 deletions l10n_ro_intrastat_xml/tests/test_intrastat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ def setUp(self):
super(TestIntrastat, self).setUp()
self.env.user.company_id.write({"vat": "RO20603502"})
self.intrastat = self.env["account.intrastat.code"].create(
{"name": "test", "code": "84221100",
# "suppl_unit_code": "p/st",
}
{
"name": "test",
"code": "84221100",
# "suppl_unit_code": "p/st",
}
)

self.product_1 = self.env["product.product"].create(
Expand Down
2 changes: 1 addition & 1 deletion l10n_ro_invoice_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Romania - Invoice Report Terrabit",
"summary": "Localizare Terrabit - Facturi, Chitanta",
"version": "15.0.3.2.0",
"version": "15.0.3.2.1",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"license": "AGPL-3",
Expand Down
36 changes: 35 additions & 1 deletion l10n_ro_invoice_report/views/invoice_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,23 @@
</thead>
<!-- display_type -->
<tbody class="invoice_tbody">
<t t-foreach="o.invoice_line_ids" t-as="l">
<t t-set="current_subtotal" t-value="0" />
<t
t-set="lines"
t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"
/>
<t t-foreach="lines" t-as="l">

<t
t-set="current_subtotal"
t-value="current_subtotal + l.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"
/>
<t
t-set="current_subtotal"
t-value="current_subtotal + l.price_total"
groups="account.group_show_line_subtotals_tax_included"
/>
<tr t-if="not l.display_type">
<td>
<t t-esc="nr_crt" />
Expand Down Expand Up @@ -296,6 +312,24 @@
<span t-field="l.name" t-options="{'widget': 'text'}" />
</td>
</tr>
<tr t-if="l.display_type == 'line_section'">
<td colspan="99">
<strong t-field="l.name" t-options="{'widget': 'text'}" />
</td>
<t t-set="current_section" t-value="l" />
<t t-set="current_subtotal" t-value="0" />
</tr>
<t t-if="current_section and (l_last or lines[l_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td colspan="99">
<strong class="mr16">Subtotal:</strong>
<span
t-esc="current_subtotal"
t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}"
/>
</td>
</tr>
</t>
</t>

<t t-foreach="range(nr_crt,5)" t-as="l">
Expand Down

0 comments on commit 37d9041

Please sign in to comment.