Skip to content

Commit 6b784b3

Browse files
author
Francesco_Orsenigo
committed
[16.0] [MIG] l10n_it_withholding_tax_payment: Migration to 16.0
1 parent c888871 commit 6b784b3

7 files changed

Lines changed: 47 additions & 28 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* Alessandro Camilli <alessandrocamilli@openforce.it>
22
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
33
* Matteo Bilotta <mbilotta@linkgroup.it>
4+
* Nextev <web@nextev.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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def setup_withholding_data(cls, company_data):
4444
with invoice_form.invoice_line_ids.edit(0) as line_form:
4545
line_form.invoice_line_tax_wt_ids.clear()
4646
line_form.invoice_line_tax_wt_ids.add(wh_tax)
47+
invoice.company_id = company_data["company"]
4748
invoice = invoice_form.save()
4849
return invoice
4950

@@ -56,7 +57,9 @@ def set_allowed_companies(cls, company):
5657
"""
5758
context = {"allowed_company_ids": company.ids}
5859
if "allowed_company_ids" in cls.env.context:
59-
cls.env.context.pop("allowed_company_ids")
60+
ctx = dict(cls.env.context)
61+
ctx.pop("allowed_company_ids")
62+
cls.env.context = ctx
6063
cls.env.context = dict(**cls.env.context, **context)
6164

6265
@classmethod
@@ -91,7 +94,11 @@ def generate_withholding_tax_payment(self, invoice):
9194
)
9295
wh_tax_payment_wizard = (
9396
self.env["wizard.wt.move.payment.create"]
94-
.with_context(active_model=wh_tax_move._name, active_ids=wh_tax_move.ids)
97+
.with_context(
98+
active_model=wh_tax_move._name,
99+
active_ids=wh_tax_move.ids,
100+
wt_move_ids=wh_tax_move.ids,
101+
)
95102
.create({})
96103
)
97104
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)