Skip to content

Commit 518b1cc

Browse files
[MIG] intrastat_product: Migration to 19.0
1 parent ad3d2ad commit 518b1cc

16 files changed

Lines changed: 216 additions & 172 deletions

intrastat_product/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Intrastat Product
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github
24-
:target: https://github.com/OCA/intrastat-extrastat/tree/18.0/intrastat_product
24+
:target: https://github.com/OCA/intrastat-extrastat/tree/19.0/intrastat_product
2525
:alt: OCA/intrastat-extrastat
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-18-0/intrastat-extrastat-18-0-intrastat_product
27+
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-19-0/intrastat-extrastat-19-0-intrastat_product
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -144,7 +144,7 @@ Bug Tracker
144144
Bugs are tracked on `GitHub Issues <https://github.com/OCA/intrastat-extrastat/issues>`_.
145145
In case of trouble, please check there if your issue has already been reported.
146146
If you spotted it first, help us to smash it by providing a detailed and welcomed
147-
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
147+
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
148148

149149
Do not contact contributors directly about support or help with technical issues.
150150

@@ -187,6 +187,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
187187
mission is to support the collaborative development of Odoo features and
188188
promote its widespread use.
189189

190-
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/18.0/intrastat_product>`_ project on GitHub.
190+
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/19.0/intrastat_product>`_ project on GitHub.
191191

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

intrastat_product/__manifest__.py

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

88
{
99
"name": "Intrastat Product",
10-
"version": "18.0.1.1.2",
10+
"version": "19.0.1.0.0",
1111
"category": "Intrastat",
1212
"license": "AGPL-3",
1313
"summary": "Base module for Intrastat Product",

intrastat_product/models/intrastat_product_declaration.py

Lines changed: 100 additions & 93 deletions
Large diffs are not rendered by default.

intrastat_product/models/intrastat_region.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
class IntrastatRegion(models.Model):
88
_name = "intrastat.region"
99
_description = "Intrastat Region"
10-
_sql_constraints = [
11-
(
12-
"intrastat_region_code_unique",
13-
"UNIQUE(code, country_id)", # TODO add company_id ?
14-
"Code must be unique.",
15-
)
16-
]
10+
11+
_intrastat_region_code_unique = models.Constraint(
12+
"UNIQUE(code, country_id)", # TODO add company_id ?
13+
"Code must be unique.",
14+
)
1715

1816
code = fields.Char(required=True)
1917
country_id = fields.Many2one(comodel_name="res.country", required=True)

intrastat_product/models/intrastat_transaction.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ class IntrastatTransaction(models.Model):
1313
_description = "Intrastat Transaction"
1414
_rec_name = "code"
1515
_order = "code"
16-
_sql_constraints = [
17-
(
18-
"intrastat_transaction_code_unique",
19-
"UNIQUE(code, company_id)",
20-
"Code must be unique.",
21-
)
22-
]
16+
17+
_intrastat_transaction_code_unique = models.Constraint(
18+
"UNIQUE(code, company_id)",
19+
"Code must be unique.",
20+
)
2321

2422
code = fields.Char(required=True)
2523
description = fields.Text(translate=True)

intrastat_product/models/intrastat_transport_mode.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ class IntrastatTransportMode(models.Model):
1010
_name = "intrastat.transport_mode"
1111
_description = "Intrastat Transport Mode"
1212
_order = "code"
13-
_sql_constraints = [
14-
("intrastat_transport_code_unique", "UNIQUE(code)", "Code must be unique.")
15-
]
13+
14+
_code_uniq = models.Constraint(
15+
"UNIQUE(code)",
16+
"Code must be unique.",
17+
)
1618

1719
code = fields.Char(required=True)
1820
name = fields.Char(required=True, translate=True)

intrastat_product/models/intrastat_unit.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ class IntrastatUnit(models.Model):
2121
)
2222
active = fields.Boolean(default=True)
2323

24-
_sql_constraints = [
25-
(
26-
"name_uniq",
27-
"unique(name)",
28-
"An intrastat supplementary unit with the same name already exists!",
29-
)
30-
]
24+
_name_uniq = models.Constraint(
25+
"unique(name)",
26+
"An intrastat supplementary unit with the same name already exists!",
27+
)

intrastat_product/report/intrastat_product_report_xls.py

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import logging
55

6-
from odoo import _, models
6+
from odoo import models
77

88
from odoo.addons.report_xlsx_helper.report.report_xlsx_format import (
99
FORMATS,
@@ -29,30 +29,30 @@ def _get_template(self, declaration):
2929

3030
template = {
3131
"product": {
32-
"header": {"type": "string", "value": _("Product")},
32+
"header": {"type": "string", "value": self.env._("Product")},
3333
"line": {
3434
"value": self._render("line.product_id and line.product_id.name")
3535
},
3636
"width": 36,
3737
},
3838
"product_origin_country_code": {
39-
"header": {"type": "string", "value": _("Product C/O Code")},
39+
"header": {"type": "string", "value": self.env._("Product C/O Code")},
4040
"line": {
4141
"type": "string",
4242
"value": self._render("line.product_origin_country_code or ''"),
4343
},
4444
"width": 10,
4545
},
4646
"product_origin_country": {
47-
"header": {"type": "string", "value": _("Product C/O")},
47+
"header": {"type": "string", "value": self.env._("Product C/O")},
4848
"line": {
4949
"type": "string",
5050
"value": self._render("line.product_origin_country_id.name or ''"),
5151
},
5252
"width": 28,
5353
},
5454
"hs_code": {
55-
"header": {"type": "string", "value": _("Intrastat Code")},
55+
"header": {"type": "string", "value": self.env._("Intrastat Code")},
5656
"line": {
5757
"type": "string",
5858
"value": self._render("line.hs_code_id.local_code"),
@@ -62,7 +62,7 @@ def _get_template(self, declaration):
6262
"src_dest_country_code": {
6363
"header": {
6464
"type": "string",
65-
"value": _("Country Code of Origin/Destination"),
65+
"value": self.env._("Country Code of Origin/Destination"),
6666
},
6767
"line": {
6868
"type": "string",
@@ -73,7 +73,7 @@ def _get_template(self, declaration):
7373
"src_dest_country": {
7474
"header": {
7575
"type": "string",
76-
"value": _("Country of Origin/Destination"),
76+
"value": self.env._("Country of Origin/Destination"),
7777
},
7878
"line": {
7979
"type": "string",
@@ -84,7 +84,7 @@ def _get_template(self, declaration):
8484
"amount_company_currency": {
8585
"header": {
8686
"type": "string",
87-
"value": _("Fiscal Value"),
87+
"value": self.env._("Fiscal Value"),
8888
"format": FORMATS["format_theader_yellow_right"],
8989
},
9090
"line": {
@@ -97,7 +97,7 @@ def _get_template(self, declaration):
9797
"accessory_cost": {
9898
"header": {
9999
"type": "string",
100-
"value": _("Accessory Costs"),
100+
"value": self.env._("Accessory Costs"),
101101
"format": FORMATS["format_theader_yellow_right"],
102102
},
103103
"line": {
@@ -112,20 +112,23 @@ def _get_template(self, declaration):
112112
"transaction_code": {
113113
"header": {
114114
"type": "string",
115-
"value": _("Intrastat Transaction Code"),
115+
"value": self.env._("Intrastat Transaction Code"),
116116
},
117117
"line": {"value": self._render("line.transaction_id.code")},
118118
"width": 10,
119119
},
120120
"transaction": {
121-
"header": {"type": "string", "value": _("Intrastat Transaction")},
121+
"header": {
122+
"type": "string",
123+
"value": self.env._("Intrastat Transaction"),
124+
},
122125
"line": {"value": self._render("line.transaction_id.display_name")},
123126
"width": 36,
124127
},
125128
"weight": {
126129
"header": {
127130
"type": "string",
128-
"value": _("Weight"),
131+
"value": self.env._("Weight"),
129132
"format": FORMATS["format_theader_yellow_right"],
130133
},
131134
"line": {
@@ -138,7 +141,7 @@ def _get_template(self, declaration):
138141
"suppl_unit_qty": {
139142
"header": {
140143
"type": "string",
141-
"value": _("Suppl. Unit Qty"),
144+
"value": self.env._("Suppl. Unit Qty"),
142145
"format": FORMATS["format_theader_yellow_right"],
143146
},
144147
"line": {
@@ -151,47 +154,53 @@ def _get_template(self, declaration):
151154
"width": 18,
152155
},
153156
"suppl_unit": {
154-
"header": {"type": "string", "value": _("Suppl. Unit")},
157+
"header": {"type": "string", "value": self.env._("Suppl. Unit")},
155158
"line": {"value": self._render("line.intrastat_unit_id.name or ''")},
156159
"width": 14,
157160
},
158161
"incoterm": {
159-
"header": {"type": "string", "value": _("Incoterm")},
162+
"header": {"type": "string", "value": self.env._("Incoterm")},
160163
"line": {"value": self._render("line.incoterm_id.name or ''")},
161164
"width": 14,
162165
},
163166
"transport_code": {
164-
"header": {"type": "string", "value": _("Transport Mode Code")},
167+
"header": {
168+
"type": "string",
169+
"value": self.env._("Transport Mode Code"),
170+
},
165171
"line": {"value": self._render("line.transport_id.code or ''")},
166172
"width": 10,
167173
},
168174
"transport": {
169-
"header": {"type": "string", "value": _("Transport Mode")},
175+
"header": {"type": "string", "value": self.env._("Transport Mode")},
170176
"line": {"value": self._render("line.transport_id.name or ''")},
171177
"width": 14,
172178
},
173179
"region": {
174-
"header": {"type": "string", "value": _("Intrastat Region")},
180+
"header": {"type": "string", "value": self.env._("Intrastat Region")},
175181
"line": {"value": self._render("line.region_id.name or ''")},
176182
"width": 28,
177183
},
178184
"region_code": {
179-
"header": {"type": "string", "value": _("Intrastat Region Code")},
185+
"header": {
186+
"type": "string",
187+
"value": self.env._("Intrastat Region Code"),
188+
},
180189
"line": {"value": self._render("line.region_code or ''")},
181190
"width": 10,
182191
},
183192
"vat": {
184-
"header": {"type": "string", "value": _("VAT")},
193+
"header": {"type": "string", "value": self.env._("VAT")},
185194
"line": {"value": self._render("line.vat or ''")},
186195
"width": 20,
187196
},
188197
"partner_id": {
189-
"header": {"type": "string", "value": _("Partner")},
198+
"header": {"type": "string", "value": self.env._("Partner")},
190199
"line": {"value": self._render("line.partner_id.display_name or ''")},
191200
"width": 28,
192201
},
193202
"invoice": {
194-
"header": {"type": "string", "value": _("Invoice")},
203+
"header": {"type": "string", "value": self.env._("Invoice")},
195204
"line": {"value": self._render("line.invoice_id.name")},
196205
"width": 18,
197206
},
@@ -214,16 +223,16 @@ def _get_ws_params(self, wb, data, declarations):
214223
dname = " ".join([decl.year_month, type2label[decl.declaration_type]])
215224
res += [
216225
{
217-
"ws_name": " ".join([dname, _("comput.")]),
226+
"ws_name": " ".join([dname, self.env._("comput.")]),
218227
"generate_ws_method": "_intrastat_report_computation",
219-
"title": " : ".join([dname, _("Computation Lines")]),
228+
"title": " : ".join([dname, self.env._("Computation Lines")]),
220229
"wanted_list": wanted_list_computation,
221230
"col_specs": template,
222231
},
223232
{
224-
"ws_name": " ".join([dname, _("decl.")]),
233+
"ws_name": " ".join([dname, self.env._("decl.")]),
225234
"generate_ws_method": "_intrastat_report_declaration",
226-
"title": " : ".join([dname, _("Declaration Lines")]),
235+
"title": " : ".join([dname, self.env._("Declaration Lines")]),
227236
"wanted_list": wanted_list_declaration,
228237
"col_specs": template,
229238
},
@@ -235,11 +244,15 @@ def _report_title(self, ws, row_pos, ws_params, data, declaration):
235244

236245
def _empty_report(self, ws, row_pos, ws_params, data, declaration, report):
237246
if report == "computation":
238-
lines = _("Computation Lines")
247+
lines = self.env._("Computation Lines")
239248
else:
240-
lines = _("Declaration Lines")
249+
lines = self.env._("Declaration Lines")
241250
no_entries = (
242-
_("No") + " " + lines + " " + _("for period %s") % declaration.year_month
251+
self.env._("No")
252+
+ " "
253+
+ lines
254+
+ " "
255+
+ self.env._("for period %s", declaration.year_month)
243256
)
244257
ws.write_string(row_pos, 0, no_entries, FORMATS["format_left_bold"])
245258

intrastat_product/security/intrastat_security.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<field
77
name="comment"
88
>Allow to encode Intrastat Transaction Details on Invoices</field>
9-
<field name="category_id" ref="base.module_category_hidden" />
109
</record>
1110
</data>
1211
<data noupdate="1">

intrastat_product/static/description/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Intrastat Product</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:a0b4013bb072646e120af80c2d2ac680a16d24d1f5fa93706a77eb765832665a
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/intrastat-extrastat/tree/18.0/intrastat_product"><img alt="OCA/intrastat-extrastat" src="https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/intrastat-extrastat-18-0/intrastat-extrastat-18-0-intrastat_product"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/intrastat-extrastat/tree/19.0/intrastat_product"><img alt="OCA/intrastat-extrastat" src="https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/intrastat-extrastat-19-0/intrastat-extrastat-19-0-intrastat_product"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module contains common objects and fields for the Intrastat Product
379379
reporting.</p>
380380
<p>It should be used in combination with country-specific Intrastat Product
@@ -481,7 +481,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h2>
481481
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues">GitHub Issues</a>.
482482
In case of trouble, please check there if your issue has already been reported.
483483
If you spotted it first, help us to smash it by providing a detailed and welcomed
484-
<a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
484+
<a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
485485
<p>Do not contact contributors directly about support or help with technical issues.</p>
486486
</div>
487487
<div class="section" id="credits">
@@ -524,7 +524,7 @@ <h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
524524
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
525525
mission is to support the collaborative development of Odoo features and
526526
promote its widespread use.</p>
527-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/18.0/intrastat_product">OCA/intrastat-extrastat</a> project on GitHub.</p>
527+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/19.0/intrastat_product">OCA/intrastat-extrastat</a> project on GitHub.</p>
528528
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
529529
</div>
530530
</div>

0 commit comments

Comments
 (0)