Skip to content

Commit 7a73659

Browse files
matteo.togniniSirAionTech
andcommitted
[MIG] l10n_it_withholding_tax_payment: Migration to 16.0
Co-authored-by: Simone Rubino <simone.rubino@aion-tech.it>
1 parent e821676 commit 7a73659

7 files changed

Lines changed: 52 additions & 29 deletions

File tree

l10n_it_withholding_tax_payment/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"name": "ITA - Ritenuta d'acconto - Pagamenti",
77
"summary": "Gestisce le ritenute sulle fatture e sui pagamenti",
8-
"version": "14.0.1.0.2",
8+
"version": "16.0.1.0.1",
99
"development_status": "Beta",
1010
"category": "Localization/Italy",
1111
"website": "https://github.com/OCA/l10n-italy",

l10n_it_withholding_tax_payment/models/withholding_tax.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def check_unlink(self):
3838
)
3939
)
4040

41-
super().check_unlink()
41+
return super().check_unlink()
4242

4343

4444
class WithholdingTaxMovePayment(models.Model):
@@ -69,8 +69,8 @@ def _compute_total(self):
6969
required=True,
7070
default=lambda self: self.env.company,
7171
)
72-
name = fields.Char("Name")
73-
date = fields.Date(string="Date")
72+
name = fields.Char()
73+
date = fields.Date()
7474
date_payment = fields.Date("Payment Date")
7575
date_start = fields.Date("Start Date", readonly=True)
7676
date_stop = fields.Date("Stop Date", readonly=True)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
* Alessandro Camilli <alessandrocamilli@openforce.it>
22
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
33
* Matteo Bilotta <mbilotta@linkgroup.it>
4+
* Nextev <web@nextev.it>
5+
* `Aion Tech <https://aiontech.company/>`_:
6+
7+
* Simone Rubino <simone.rubino@aion-tech.it>

l10n_it_withholding_tax_payment/security/security.xml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
<!--
33
Copyright 2019 Matteo Bilotta
44
-->
5-
<odoo>
6-
<data noupdate="1">
7-
8-
<record id="withholding_tax_payment_comp_rule" model="ir.rule">
9-
<field name="name">Withholding Tax Payment Move</field>
10-
<field name="model_id" ref="model_withholding_tax_move_payment" />
11-
<field name="global" eval="True" />
12-
<field
13-
name="domain_force"
14-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
15-
</record>
16-
17-
</data>
5+
<odoo noupdate="1">
6+
<record id="withholding_tax_payment_comp_rule" model="ir.rule">
7+
<field name="name">Withholding Tax Payment Move</field>
8+
<field name="model_id" ref="model_withholding_tax_move_payment" />
9+
<field name="global" eval="True" />
10+
<field
11+
name="domain_force"
12+
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
13+
</record>
1814
</odoo>

l10n_it_withholding_tax_payment/tests/test_withholding_tax_payment.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2021 Simone Rubino - Agile Business Group
2+
# Copyright 2023 Simone Rubino - Aion Tech
23
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
34

45
from odoo.tests import Form, tagged
@@ -39,7 +40,9 @@ def setup_withholding_data(cls, company_data):
3940
"""
4041
cls.set_allowed_companies(company_data["company"])
4142
wh_tax = cls.setup_withholding_tax(company_data)
42-
invoice = cls.init_invoice("in_invoice", amounts=[100])
43+
invoice = cls.init_invoice(
44+
"in_invoice", amounts=[100], company=company_data["company"]
45+
)
4346
invoice_form = Form(invoice)
4447
with invoice_form.invoice_line_ids.edit(0) as line_form:
4548
line_form.invoice_line_tax_wt_ids.clear()
@@ -56,7 +59,9 @@ def set_allowed_companies(cls, company):
5659
"""
5760
context = {"allowed_company_ids": company.ids}
5861
if "allowed_company_ids" in cls.env.context:
59-
cls.env.context.pop("allowed_company_ids")
62+
ctx = dict(cls.env.context)
63+
ctx.pop("allowed_company_ids")
64+
cls.env.context = ctx
6065
cls.env.context = dict(**cls.env.context, **context)
6166

6267
@classmethod
@@ -91,7 +96,10 @@ def generate_withholding_tax_payment(self, invoice):
9196
)
9297
wh_tax_payment_wizard = (
9398
self.env["wizard.wt.move.payment.create"]
94-
.with_context(active_model=wh_tax_move._name, active_ids=wh_tax_move.ids)
99+
.with_context(
100+
active_model=wh_tax_move._name,
101+
active_ids=wh_tax_move.ids,
102+
)
95103
.create({})
96104
)
97105
wh_tax_payment_action = wh_tax_payment_wizard.generate()

l10n_it_withholding_tax_payment/views/withholding_tax.xml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<field name="name">withholding.tax.move.payment.view.tree</field>
3838
<field name="model">withholding.tax.move.payment</field>
3939
<field name="arch" type="xml">
40-
<tree string="Withholding Payment Move">
40+
<tree>
4141
<field name="name" />
4242
<field name="date" />
4343
<field name="date_start" />
@@ -72,6 +72,7 @@
7272
string="Create Account Move"
7373
type="object"
7474
attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('move_id', '!=', False)]}"
75+
class="oe_highlight"
7576
/>
7677
<field
7778
name="state"
@@ -80,8 +81,10 @@
8081
/>
8182
</header>
8283
<sheet string="Withholding Payment Move">
84+
<div class="oe_title">
85+
<h1><field name="name" readonly="1" /></h1>
86+
</div>
8387
<group>
84-
<field name="name" />
8588
<field name="date" />
8689
<field
8790
name="company_id"
@@ -96,10 +99,22 @@
9699
<field name="date_stop" />
97100
</group>
98101
<group string="Account Setting">
99-
<field name="date_payment" />
100-
<field name="journal_id" />
101-
<field name="account_id" />
102-
<field name="move_id" />
102+
<field
103+
name="date_payment"
104+
required="1"
105+
attrs="{'readonly': [('state', '=', 'confirmed')]}"
106+
/>
107+
<field
108+
name="journal_id"
109+
required="1"
110+
attrs="{'readonly': [('state', '=', 'confirmed')]}"
111+
/>
112+
<field
113+
name="account_id"
114+
required="1"
115+
attrs="{'readonly': [('state', '=', 'confirmed')]}"
116+
/>
117+
<field name="move_id" readonly="1" />
103118
</group>
104119
</group>
105120
<newline />

l10n_it_withholding_tax_payment/wizard/create_move_payment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ def _default_wt_moves(self):
2525
def generate(self):
2626
wt_move_payment_obj = self.env["withholding.tax.move.payment"]
2727
wt_payment = wt_move_payment_obj.generate_from_moves(self.wt_move_ids)
28-
view = self.env["ir.model.data"].get_object_reference(
29-
"l10n_it_withholding_tax_payment", "view_withholding_move_payment_form"
28+
view = self.env["ir.model.data"]._xmlid_lookup(
29+
"l10n_it_withholding_tax_payment.view_withholding_move_payment_form"
3030
)
31-
view_id = view[1] or False
31+
view_id = view[2] or False
3232

3333
return {
3434
"name": _("Withholding Tax Payment"),

0 commit comments

Comments
 (0)