Skip to content

Commit 80af63d

Browse files
jue-adhocjjscarafia
authored andcommitted
[IMP] l10n_ar_tax: Add action to view previous payment withholdings on tree view
1 parent a577a89 commit 80af63d

4 files changed

Lines changed: 38 additions & 2 deletions

File tree

l10n_ar_tax/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
##############################################################################
2020
{
2121
"name": "Automatic Argentinian Withholdings on Payments",
22-
"version": "18.0.1.9.0",
22+
"version": "18.0.1.10.0",
2323
"author": "ADHOC SA,Odoo Community Association (OCA)",
2424
"website": "www.adhoc.com.ar",
2525
"license": "AGPL-3",

l10n_ar_tax/models/l10n_ar_payment_withholding.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,21 @@ def _get_withholding_tax(self):
211211
"""Return the applicable withheld tax"""
212212
self.ensure_one()
213213
return self.tax_id
214+
215+
##########
216+
# ACTIONS
217+
##########
218+
219+
def action_l10n_ar_payment_withholding_tree(self):
220+
"""Open a tree view showing previous withholdings."""
221+
same_period_withholdings = (
222+
self.env["account.move.line"].search(self._get_same_period_withholdings_domain()).withholding_id
223+
)
224+
return {
225+
"name": "Previous Withholdings",
226+
"type": "ir.actions.act_window",
227+
"res_model": "l10n_ar.payment.withholding",
228+
"view_mode": "list",
229+
"view_id": self.env.ref("l10n_ar_tax.view_l10n_ar_payment_withholding_tree").id,
230+
"domain": [("id", "in", same_period_withholdings.ids)],
231+
}

l10n_ar_tax/views/account_payment_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<field name="amount"/>
5656
<field name="ref" optional="hide" readonly="l10n_ar_tax_type in ['earnings', 'earnings_scale']" force_save="1"/>
5757
<button name="%(action_report_withholding_certificate)d" icon="fa-print " title="Print withholding voucher" type="action" invisible="parent.partner_type != 'supplier' or parent.state == 'draft'"/>
58+
<button name="action_l10n_ar_payment_withholding_tree" icon="fa-bars" title="Watch previous withholdings" type="object" invisible="parent.partner_type != 'supplier' or l10n_ar_tax_type not in ['earnings', 'earnings_scale']"/>
5859
</list>
5960
</field>
6061
</page>

l10n_ar_tax/views/l10n_ar_payment_withholding_views.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,22 @@
2121
</form>
2222
</field>
2323
</record>
24-
24+
<record id="view_l10n_ar_payment_withholding_tree" model="ir.ui.view">
25+
<field name="name">l10n_ar.payment.withholding.tree</field>
26+
<field name="model">l10n_ar.payment.withholding</field>
27+
<field name="arch" type="xml">
28+
<list>
29+
<field name="payment_id"/>
30+
<field name="withholding_sequence_id"/>
31+
<field name="company_id" column_invisible="True"/>
32+
<field name="currency_id" column_invisible="True"/>
33+
<field name="l10n_ar_tax_type" column_invisible="True"/>
34+
<field name="tax_id" domain="[('l10n_ar_withholding_payment_type', '=', parent.partner_type), ('company_id', '=', parent.company_id)]" options="{'no_create': True}"/>
35+
<field name="name"/>
36+
<field name="base_amount"/>
37+
<field name="amount"/>
38+
<field name="ref"/>
39+
</list>
40+
</field>
41+
</record>
2542
</odoo>

0 commit comments

Comments
 (0)