Skip to content

Commit 8044b1d

Browse files
committed
[MIG] l10n_it_intrastat_statement: Migration to 14.0
1 parent 827bb33 commit 8044b1d

16 files changed

Lines changed: 254 additions & 254 deletions

l10n_it_intrastat_statement/README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ ITA - Dichiarazione Intrastat
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
17-
:target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_intrastat_statement
17+
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement
1818
:alt: OCA/l10n-italy
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_intrastat_statement
20+
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_intrastat_statement
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/122/12.0
23+
:target: https://runbot.odoo-community.org/runbot/122/14.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -82,7 +82,7 @@ I dati presi dalle fatture e dalle note di credito indicate come soggette ad Int
8282

8383
N.B.: i record presenti nelle schede "Rettifica beni - Sezione 2" e "Rettifica servizi - Sezione 4", sia per gli acquisti che per le vendite, vanno modificati per inserire i dati obbligatori mancanti.
8484

85-
Inseriti i dati e salvata la dichiarazione, è possibile procedere all’elaborazione dei file da inviare all’Agenzia delle Dogane tramite l’apposito pulsante «Esporta file».
85+
Inseriti i dati e salvata la dichiarazione, è possibile procedere all’elaborazione dei file da inviare all’Agenzia delle Dogane tramite l’apposito pulsante «Esporta file».
8686

8787
Il pulsante fa partire una procedura guidata, che permette di scegliere quale tipo di file estrarre:
8888

@@ -100,7 +100,7 @@ Bug Tracker
100100
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
101101
In case of trouble, please check there if your issue has already been reported.
102102
If you spotted it first, help us smashing it by providing a detailed and welcomed
103-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
103+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
104104

105105
Do not contact contributors directly about support or help with technical issues.
106106

@@ -136,6 +136,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
136136
mission is to support the collaborative development of Odoo features and
137137
promote its widespread use.
138138

139-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_intrastat_statement>`_ project on GitHub.
139+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement>`_ project on GitHub.
140140

141141
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_intrastat_statement/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
{
55
"name": "ITA - Dichiarazione Intrastat",
6-
"version": "12.0.1.2.2",
6+
"version": "14.0.1.0.0",
77
"category": "Account",
88
"summary": "Dichiarazione Intrastat per l'Agenzia delle Dogane",
99
"author": "Openforce, Link IT srl, Agile Business Group, "
1010
"Odoo Community Association (OCA)",
11-
"website": "https://github.com/OCA/l10n-italy" "12.0/l10n_it_intrastat_statement",
11+
"website": "https://github.com/OCA/l10n-italy",
1212
"license": "AGPL-3",
1313
"depends": [
1414
"l10n_it_intrastat",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<odoo>
3+
<record id="statement_multi_company" model="ir.rule">
4+
<field
5+
name="domain_force"
6+
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
7+
</record>
8+
</odoo>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from openupgradelib import openupgrade
2+
3+
4+
@openupgrade.migrate()
5+
def migrate(env, version):
6+
openupgrade.load_data(
7+
env.cr,
8+
"l10n_it_intrastat_statement",
9+
"migrations/14.0.1.0.0/noupdate_changes.xml",
10+
)

l10n_it_intrastat_statement/models/intrastat_statement.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class AccountIntrastatStatement(models.Model):
4545
_description = "Intrastat Statement"
4646
_rec_name = "number"
4747

48-
@api.multi
4948
def round_min_amount(self, amount, company=None, prec_digits=None, truncate=False):
5049
"""
5150
Return an integer representing `amount`,
@@ -76,7 +75,6 @@ def round_min_amount(self, amount, company=None, prec_digits=None, truncate=Fals
7675

7776
return max(round_amount or 1, company.intrastat_min_amount)
7877

79-
@api.multi
8078
def _compute_amount_section(self, section_type, section_number):
8179
"""
8280
Compute operation_number and amount for specified section.
@@ -149,7 +147,6 @@ def _compute_progressive(self):
149147
st = self.search([], order="number desc", limit=1)
150148
return (st.number or 0) + 1
151149

152-
@api.multi
153150
def recompute_sequence_lines(self):
154151
for statement in self:
155152
for section_type in ["purchase", "sale"]:
@@ -174,23 +171,23 @@ def _get_sequence(self):
174171
company_id = fields.Many2one(
175172
comodel_name="res.company",
176173
string="Company",
177-
default=lambda self: self.env.user.company_id.id,
174+
default=lambda self: self.env.company.id,
178175
required=True,
179176
)
180177
vat_taxpayer = fields.Char(
181178
string="Taxpayer VAT Number",
182179
required=True,
183-
default=lambda self: self.env.user.company_id.partner_id.vat
184-
and self.env.user.company_id.partner_id.vat[2:]
180+
default=lambda self: self.env.company.partner_id.vat
181+
and self.env.company.partner_id.vat[2:]
185182
or False,
186183
)
187184
intrastat_vat_delegate = fields.Char(
188185
string="Delegate VAT Number",
189-
default=lambda self: self.env.user.company_id.intrastat_delegated_vat,
186+
default=lambda self: self.env.company.intrastat_delegated_vat,
190187
)
191188
intrastat_name_delegate = fields.Char(
192189
string="Delegate Name",
193-
default=lambda self: self.env.user.company_id.intrastat_delegated_name,
190+
default=lambda self: self.env.company.intrastat_delegated_name,
194191
)
195192
fiscalyear = fields.Integer(
196193
string="Year", required=True, default=fields.Date.today().year
@@ -244,7 +241,7 @@ def _get_sequence(self):
244241
comodel_name="account.intrastat.custom",
245242
string="Customs Section",
246243
required=True,
247-
default=lambda self: self.env.user.company_id.intrastat_custom_id,
244+
default=lambda self: self.env.company.intrastat_custom_id,
248245
)
249246
sale = fields.Boolean(string="Sales", default=True)
250247
purchase = fields.Boolean(string="Purchases", default=True)
@@ -415,14 +412,12 @@ def create(self, vals):
415412
statement._normalize_statement()
416413
return statement
417414

418-
@api.multi
419415
def write(self, vals):
420416
res = super().write(vals)
421417
self._normalize_statement()
422418
self.recompute_sequence_lines()
423419
return res
424420

425-
@api.multi
426421
@api.depends("fiscalyear", "period_type", "period_number")
427422
def _compute_dates(self):
428423
for statement in self:
@@ -440,7 +435,6 @@ def _compute_dates(self):
440435
statement.date_start = fields.Date.to_date(period_date_start)
441436
statement.date_stop = fields.Date.to_date(period_date_stop)
442437

443-
@api.multi
444438
def get_dates_start_stop(self):
445439
self.ensure_one()
446440
year = self.fiscalyear
@@ -462,7 +456,6 @@ def get_dates_start_stop(self):
462456
)
463457
return period_date_start, period_date_stop
464458

465-
@api.multi
466459
def _get_period_ref(self):
467460
self.ensure_one()
468461
res = {"year_id": self.fiscalyear}
@@ -474,7 +467,6 @@ def _get_period_ref(self):
474467
res.update({"month": self.period_number})
475468
return res
476469

477-
@api.multi
478470
def _normalize_statement(self):
479471
# Unlink lines sale/purchase sections
480472
self.ensure_one()
@@ -484,7 +476,6 @@ def _normalize_statement(self):
484476
self._unlink_sections(section_type="purchase")
485477
return True
486478

487-
@api.multi
488479
def _unlink_sections(self, section_type="all"):
489480
"""
490481
Unlink lines sale/purchase sections.
@@ -506,7 +497,6 @@ def _unlink_sections(self, section_type="all"):
506497
self.purchase_section4_ids.unlink()
507498
return True
508499

509-
@api.multi
510500
def _get_progressive_interchange(self):
511501
self.ensure_one()
512502
prg = 0
@@ -536,7 +526,6 @@ def _get_file_name(self):
536526
"{:2s}".format(str(prg).zfill(2)),
537527
)
538528

539-
@api.multi
540529
def _prepare_export_head(self):
541530
self.ensure_one()
542531

@@ -596,7 +585,6 @@ def _prepare_export_head(self):
596585
rcd += "\r\n"
597586
return rcd
598587

599-
@api.multi
600588
def _prepare_export_prefix(self, ref_number, line=None):
601589
"""
602590
Fixed part for every line of the exported file
@@ -651,7 +639,6 @@ def _format_negative_number_frontispiece(self, number):
651639
number[len(number) - 1] = interchange[int(last_char)]
652640
return "".join(number)
653641

654-
@api.multi
655642
def _prepare_export_frontispiece(self, kind, ref_number):
656643
self.ensure_one()
657644
rcd = self._prepare_export_prefix(ref_number)
@@ -695,7 +682,6 @@ def _prepare_export_frontispiece(self, kind, ref_number):
695682
rcd += "\r\n"
696683
return rcd
697684

698-
@api.multi
699685
def generate_file_export(self):
700686
self.ensure_one()
701687
file_content = ""
@@ -765,7 +751,6 @@ def generate_file_export(self):
765751

766752
return file_content
767753

768-
@api.multi
769754
def compute_statement(self):
770755
self.ensure_one()
771756
# Unlink existing lines
@@ -776,19 +761,19 @@ def compute_statement(self):
776761

777762
# Search intrastat lines
778763
domain = [
779-
("move_id.date", ">=", period_date_start),
780-
("move_id.date", "<=", period_date_stop),
764+
("invoice_date", ">=", period_date_start),
765+
("invoice_date", "<=", period_date_stop),
781766
("intrastat", "=", True),
782767
]
783768
inv_type = []
784769
if self.sale:
785770
inv_type += ["out_invoice", "out_refund"]
786771
if self.purchase:
787772
inv_type += ["in_invoice", "in_refund"]
788-
domain.append(("type", "in", inv_type))
773+
domain.append(("move_type", "in", inv_type))
789774

790775
statement_data = dict()
791-
invoices = self.env["account.invoice"].search(domain)
776+
invoices = self.env["account.move"].search(domain)
792777
for inv_intra_line in invoices.mapped("intrastat_line_ids"):
793778
for section_type in ["purchase", "sale"]:
794779
for section_number in range(1, 5):
@@ -844,7 +829,6 @@ def get_section_model(section_type, section_number):
844829
def get_section_field_name(section_type, section_number):
845830
return "{}_section{}_ids".format(section_type, section_number)
846831

847-
@api.multi
848832
def refund_line(self, line, to_ref_obj):
849833
"""Refund line into sale if period ref is the same of the statement"""
850834
self.ensure_one()

0 commit comments

Comments
 (0)