Skip to content

Commit

Permalink
Merge PR #2193 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by eLBati
  • Loading branch information
OCA-git-bot committed May 24, 2021
2 parents b5cca2a + a20bfc5 commit c7f5b88
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions l10n_it_withholding_tax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
],
"data": [
'views/account.xml',
'views/report_invoice.xml',
'views/withholding_tax.xml',
'security/ir.model.access.csv',
'security/security.xml',
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_withholding_tax/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ def _amount_withholding_tax(self):
invoice.amount_net_pay_residual = amount_net_pay_residual

withholding_tax = fields.Boolean('Withholding Tax')
withholding_tax_in_print = fields.Boolean(
"Show Withholding Tax In Print", default=True)
withholding_tax_line_ids = fields.One2many(
'account.invoice.withholding.tax', 'invoice_id',
'Withholding Tax Lines', copy=True,
Expand Down
12 changes: 12 additions & 0 deletions l10n_it_withholding_tax/views/account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
attrs="{'invisible': ['|', ('state', '=', 'draft'), ('withholding_tax', '=', False)]}" class="oe_subtotal_footer_separator"/>
</xpath>

<xpath expr="//page[@name='other_info']/group[1]/group[last()]" position="after">
<group name="withholding_tax_info">
<field name="withholding_tax_in_print"/>
</group>
</xpath>

</field>
</record>

Expand Down Expand Up @@ -116,6 +122,12 @@
attrs="{'invisible': ['|', ('state', '=', 'draft'), ('withholding_tax', '=', False)]}" class="oe_subtotal_footer_separator"/>
</xpath>

<xpath expr="//page[@name='other_info']/group[1]/group[last()]" position="after">
<group name="withholding_tax_info">
<field name="withholding_tax_in_print"/>
</group>
</xpath>

</field>
</record>

Expand Down
65 changes: 65 additions & 0 deletions l10n_it_withholding_tax/views/report_invoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="print_withholding_tax" model="ir.ui.view">
<field name="name">print_withholding_tax</field>
<field name="inherit_id" ref="account.report_invoice_document"/>
<field name="arch" type="xml">
<xpath expr="//table[@name='invoice_line_table']/thead/tr/th[6]" position="after">
<t t-if="o.withholding_tax_in_print and o.withholding_tax">
<th class="text-right">
Withholding Tax
</th>
</t>
</xpath>

<xpath expr="//table[@name='invoice_line_table']/tbody[hasclass('invoice_tbody')]//td[6]" position="after">
<t t-if="o.withholding_tax_in_print and o.withholding_tax">
<td class="text-right">
<span t-esc="', '.join(map(lambda x: (x.name), line.invoice_line_tax_wt_ids))"/>
</td>
</t>
</xpath>

<xpath expr="//div[@id='total']//tr[hasclass('o_total')]" position="after">
<t t-if="o.withholding_tax_in_print and o.withholding_tax">
<tr>
<td>
<span>Withholding Tax</span>
</td>
<td class="text-right">
<span t-field="o.withholding_tax_amount"/>
</td>
</tr>
<tr class="border-black">
<td>
<strong>Net To Pay</strong>
</td>
<td class="text-right">
<span t-field="o.amount_net_pay"/>
</td>
</tr>
</t>
</xpath>
</field>
</record>

<record id="report_invoice_document_with_payments" model="ir.ui.view">
<field name="name">print_withholding_tax_with_payments</field>
<field name="inherit_id" ref="account.report_invoice_document_with_payments"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='total']/div/table" position="inside">
<t t-if="o.withholding_tax_in_print and len(payments_vals) > 0">
<tr class="border-black">
<td>
<strong>Residual Net To Pay</strong>
</td>
<td class="text-right">
<span t-field="o.amount_net_pay_residual"/>
</td>
</tr>
</t>
</xpath>
</field>
</record>

</odoo>

0 comments on commit c7f5b88

Please sign in to comment.