Skip to content

Commit 1ddf72e

Browse files
committed
[MIG] l10n_it_intrastat_statement: Migration to 18.0
1 parent 4af5cc1 commit 1ddf72e

18 files changed

+125
-141
lines changed

l10n_it_intrastat_statement/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ ITA - Dichiarazione Intrastat
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
20-
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement
20+
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_intrastat_statement
2121
:alt: OCA/l10n-italy
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_intrastat_statement
23+
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_intrastat_statement
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -133,7 +133,7 @@ Bug Tracker
133133
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
134134
In case of trouble, please check there if your issue has already been reported.
135135
If you spotted it first, help us to smash it by providing a detailed and welcomed
136-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
136+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
137137

138138
Do not contact contributors directly about support or help with technical issues.
139139

@@ -171,6 +171,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
171171
mission is to support the collaborative development of Odoo features and
172172
promote its widespread use.
173173

174-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement>`_ project on GitHub.
174+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_intrastat_statement>`_ project on GitHub.
175175

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

l10n_it_intrastat_statement/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "ITA - Dichiarazione Intrastat",
6-
"version": "16.0.1.3.3",
6+
"version": "18.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, "

l10n_it_intrastat_statement/models/intrastat_statement.py

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from dateutil.relativedelta import relativedelta
77

8-
from odoo import _, api, fields, models
8+
from odoo import api, fields, models
99
from odoo.exceptions import UserError, ValidationError
1010
from odoo.tools import float_round
1111

@@ -99,7 +99,7 @@ def _compute_amount_section(self, section_type, section_number):
9999
]
100100
):
101101
raise UserError(
102-
_(
102+
self.env._(
103103
"Wrong section type %(section_type)s or number %(section_number)s",
104104
section_type=section_type,
105105
section_number=section_number,
@@ -209,12 +209,8 @@ def _get_sequence(self):
209209
default=1,
210210
required=True,
211211
)
212-
date_start = fields.Date(
213-
string="Start Date", store=True, readonly=True, compute="_compute_dates"
214-
)
215-
date_stop = fields.Date(
216-
string="Stop Date", store=True, readonly=True, compute="_compute_dates"
217-
)
212+
date_start = fields.Date(string="Start Date", store=True, compute="_compute_dates")
213+
date_stop = fields.Date(string="Stop Date", store=True, compute="_compute_dates")
218214
content_type = fields.Selection(
219215
selection=[
220216
("0", "Normal Period"),
@@ -277,13 +273,11 @@ def _get_sequence(self):
277273
sale_section1_operation_number = fields.Integer(
278274
string="Operation Count - Sales Section 1",
279275
store=True,
280-
readonly=True,
281276
compute="_compute_amount_sale_s1",
282277
)
283278
sale_section1_operation_amount = fields.Integer(
284279
string="Operation Amount - Sales Section 1",
285280
store=True,
286-
readonly=True,
287281
compute="_compute_amount_sale_s1",
288282
)
289283
sale_section2_ids = fields.One2many(
@@ -294,13 +288,11 @@ def _get_sequence(self):
294288
sale_section2_operation_number = fields.Integer(
295289
string="Operation Count - Sales Section 2",
296290
store=True,
297-
readonly=True,
298291
compute="_compute_amount_sale_s2",
299292
)
300293
sale_section2_operation_amount = fields.Integer(
301294
string="Operation Amount - Sales Section 2",
302295
store=True,
303-
readonly=True,
304296
compute="_compute_amount_sale_s2",
305297
)
306298
sale_section3_ids = fields.One2many(
@@ -311,13 +303,11 @@ def _get_sequence(self):
311303
sale_section3_operation_number = fields.Integer(
312304
string="Operation Count - Sales Section 3",
313305
store=True,
314-
readonly=True,
315306
compute="_compute_amount_sale_s3",
316307
)
317308
sale_section3_operation_amount = fields.Integer(
318309
string="Operation Amount - Sales Section 3",
319310
store=True,
320-
readonly=True,
321311
compute="_compute_amount_sale_s3",
322312
)
323313
sale_section4_ids = fields.One2many(
@@ -328,13 +318,11 @@ def _get_sequence(self):
328318
sale_section4_operation_number = fields.Integer(
329319
string="Operation Count - Sales Section 4",
330320
store=True,
331-
readonly=True,
332321
compute="_compute_amount_sale_s4",
333322
)
334323
sale_section4_operation_amount = fields.Integer(
335324
string="Operation Amount - Sales Section 4",
336325
store=True,
337-
readonly=True,
338326
compute="_compute_amount_sale_s4",
339327
)
340328

@@ -349,13 +337,11 @@ def _get_sequence(self):
349337
purchase_section1_operation_number = fields.Integer(
350338
string="Operation Count - Purchases Section 1",
351339
store=True,
352-
readonly=True,
353340
compute="_compute_amount_purchase_s1",
354341
)
355342
purchase_section1_operation_amount = fields.Integer(
356343
string="Operation Amount - Purchases Section 1",
357344
store=True,
358-
readonly=True,
359345
compute="_compute_amount_purchase_s1",
360346
)
361347
purchase_section2_ids = fields.One2many(
@@ -366,13 +352,11 @@ def _get_sequence(self):
366352
purchase_section2_operation_number = fields.Integer(
367353
string="Operation Count - Purchases Section 2",
368354
store=True,
369-
readonly=True,
370355
compute="_compute_amount_purchase_s2",
371356
)
372357
purchase_section2_operation_amount = fields.Integer(
373358
string="Operation Amount - Purchases Section 2",
374359
store=True,
375-
readonly=True,
376360
compute="_compute_amount_purchase_s2",
377361
)
378362
purchase_section3_ids = fields.One2many(
@@ -383,13 +367,11 @@ def _get_sequence(self):
383367
purchase_section3_operation_number = fields.Integer(
384368
string="Operation Count - Purchases Section 3",
385369
store=True,
386-
readonly=True,
387370
compute="_compute_amount_purchase_s3",
388371
)
389372
purchase_section3_operation_amount = fields.Integer(
390373
string="Operation Amount - Purchases Section 3",
391374
store=True,
392-
readonly=True,
393375
compute="_compute_amount_purchase_s3",
394376
)
395377
purchase_section4_ids = fields.One2many(
@@ -400,13 +382,11 @@ def _get_sequence(self):
400382
purchase_section4_operation_number = fields.Integer(
401383
string="Operation Count - Purchases Section 4",
402384
store=True,
403-
readonly=True,
404385
compute="_compute_amount_purchase_s4",
405386
)
406387
purchase_section4_operation_amount = fields.Integer(
407388
string="Operation Amount - Purchases Section 4",
408389
store=True,
409-
readonly=True,
410390
compute="_compute_amount_purchase_s4",
411391
)
412392

@@ -738,7 +718,7 @@ def generate_file_export(self):
738718

739719
# Data validation
740720
if not file_content:
741-
raise ValidationError(_("Nothing to export"))
721+
raise ValidationError(self.env._("Nothing to export"))
742722
if (
743723
not self.sale_section1_ids
744724
and not self.sale_section2_ids
@@ -749,7 +729,7 @@ def generate_file_export(self):
749729
and not self.purchase_section3_ids
750730
and not self.purchase_section4_ids
751731
):
752-
raise ValidationError(_("Statement without lines"))
732+
raise ValidationError(self.env._("Statement without lines"))
753733

754734
return file_content
755735

@@ -852,7 +832,7 @@ def refund_line(self, line, to_ref_obj):
852832
if line_to_refund:
853833
if line_to_refund.amount_euro < line.amount_euro:
854834
raise ValidationError(
855-
_(
835+
self.env._(
856836
"Invoice and credit note in the same period with"
857837
" credit note > invoice for partner %s"
858838
)
@@ -888,9 +868,9 @@ def _constrain_period_number(self):
888868
1 <= statement.period_number <= 12
889869
):
890870
raise ValidationError(
891-
_("Period Not Valid! Range accepted: from 1 to 12")
871+
self.env._("Period Not Valid! Range accepted: from 1 to 12")
892872
)
893873
if statement.period_type == "T" and not (1 <= statement.period_number <= 4):
894874
raise ValidationError(
895-
_("Period Not Valid! Range accepted: from 1 to 4")
875+
self.env._("Period Not Valid! Range accepted: from 1 to 4")
896876
)

l10n_it_intrastat_statement/models/intrastat_statement_purchase_section1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Simone Rubino - Agile Business Group
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55

66
from .intrastat_statement import format_9, format_x
77

@@ -30,7 +30,6 @@ class IntrastatStatementPurchaseSection1(models.Model):
3030
)
3131
additional_units_uom = fields.Char(
3232
string="Additional Unit of Measure",
33-
readonly=True,
3433
related="intrastat_code_id.additional_unit_uom_id.name",
3534
)
3635
statistic_amount_euro = fields.Integer(string="Statistic Value in Euro")
@@ -129,7 +128,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
129128

130129
def _prepare_export_line(self):
131130
self.ensure_one()
132-
self._export_line_checks(_("Purchase"), self.get_section_number())
131+
self._export_line_checks(self.env._("Purchase"), self.get_section_number())
133132

134133
rcd = ""
135134
# Codice dello Stato membro del fornitore

l10n_it_intrastat_statement/models/intrastat_statement_purchase_section2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Simone Rubino - Agile Business Group
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55
from odoo.exceptions import ValidationError
66

77
from .intrastat_statement import format_9, format_x
@@ -76,32 +76,32 @@ def _export_line_checks(self, section_label, section_number):
7676
res = super()._export_line_checks(section_label, section_number)
7777
if not self.year_id:
7878
raise ValidationError(
79-
_("Missing reference year on 'Purchases - Section 2'")
79+
self.env._("Missing reference year on 'Purchases - Section 2'")
8080
)
8181
if not self.sign_variation:
8282
raise ValidationError(
83-
_("Missing adjustment sign on 'Purchases - Section 2'")
83+
self.env._("Missing adjustment sign on 'Purchases - Section 2'")
8484
)
8585
if self.statement_id.period_type == "M":
8686
if not self.month:
8787
raise ValidationError(
88-
_(
88+
self.env._(
8989
"Missing reference month "
9090
"on 'Purchases - Section 2' adjustment"
9191
)
9292
)
9393
elif self.statement_id.period_type == "T":
9494
if not self.quarterly:
9595
raise ValidationError(
96-
_(
96+
self.env._(
9797
"Missing reference quarter "
9898
"on 'Purchases - Section 2' adjustment"
9999
)
100100
)
101101
return res
102102

103103
def _prepare_export_line(self):
104-
self._export_line_checks(_("Purchase"), self.get_section_number())
104+
self._export_line_checks(self.env._("Purchase"), self.get_section_number())
105105

106106
rcd = ""
107107
# Mese di riferimento del riepilogo da rettificare

l10n_it_intrastat_statement/models/intrastat_statement_purchase_section3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Simone Rubino - Agile Business Group
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55

66
from .intrastat_statement import format_9, format_x
77

@@ -48,7 +48,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
4848
return res
4949

5050
def _prepare_export_line(self):
51-
self._export_line_checks(_("Purchase"), self.get_section_number())
51+
self._export_line_checks(self.env._("Purchase"), self.get_section_number())
5252

5353
rcd = ""
5454
# Codice dello Stato membro del fornitore

l10n_it_intrastat_statement/models/intrastat_statement_purchase_section4.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Simone Rubino - Agile Business Group
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55
from odoo.exceptions import ValidationError
66

77
from .intrastat_statement import format_9, format_x
@@ -69,28 +69,28 @@ def _export_line_checks(self, section_label, section_number):
6969
res = super()._export_line_checks(section_label, section_number)
7070
if not self.year_id:
7171
raise ValidationError(
72-
_("Missing reference year on 'Purchases - Section 4'")
72+
self.env._("Missing reference year on 'Purchases - Section 4'")
7373
)
7474
if not self.intrastat_custom_id:
7575
raise ValidationError(
76-
_("Missing customs section on 'Purchases - Section 4'")
76+
self.env._("Missing customs section on 'Purchases - Section 4'")
7777
)
7878
if not self.protocol:
7979
raise ValidationError(
80-
_("Missing protocol number on 'Purchases - Section 4'")
80+
self.env._("Missing protocol number on 'Purchases - Section 4'")
8181
)
8282
if not self.progressive_to_modify:
8383
raise ValidationError(
84-
_("Missing progressive to adjust on 'Purchases - Section 4'")
84+
self.env._("Missing progressive to adjust on 'Purchases - Section 4'")
8585
)
8686
if not self.country_payment_id:
8787
raise ValidationError(
88-
_("Missing payment country on 'Purchases - Section 4'")
88+
self.env._("Missing payment country on 'Purchases - Section 4'")
8989
)
9090
return res
9191

9292
def _prepare_export_line(self):
93-
self._export_line_checks(_("Purchase"), 4)
93+
self._export_line_checks(self.env._("Purchase"), 4)
9494

9595
rcd = ""
9696
# Codice della sezione doganale in cui è stato registrata la

l10n_it_intrastat_statement/models/intrastat_statement_sale_section1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 Simone Rubino - Agile Business Group
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo import _, api, fields, models
4+
from odoo import api, fields, models
55

66
from .intrastat_statement import format_9, format_x
77

@@ -25,7 +25,6 @@ class IntrastatStatementSaleSection1(models.Model):
2525
)
2626
additional_units_uom = fields.Char(
2727
string="Additional Unit of Measure",
28-
readonly=True,
2928
related="intrastat_code_id.additional_unit_uom_id.name",
3029
)
3130
statistic_amount_euro = fields.Integer(string="Statistic Value in Euro")
@@ -138,7 +137,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
138137
@api.model
139138
def _prepare_export_line(self):
140139
self.ensure_one()
141-
self._export_line_checks(_("Sales"), self.get_section_number())
140+
self._export_line_checks(self.env._("Sales"), self.get_section_number())
142141

143142
rcd = ""
144143
# Codice dello Stato membro dell’acquirente

0 commit comments

Comments
 (0)