[MIG] product_harmonized_system to v15

TT36971
This commit is contained in:
Alexis de Lattre
2021-12-16 17:13:09 +01:00
committed by Víctor Martínez
parent c7046838a5
commit 379b73e11d
10 changed files with 18 additions and 85 deletions

View File

@@ -14,13 +14,13 @@ Product Harmonized System Codes
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github
:target: https://github.com/OCA/intrastat-extrastat/tree/14.0/product_harmonized_system
:target: https://github.com/OCA/intrastat-extrastat/tree/15.0/product_harmonized_system
:alt: OCA/intrastat-extrastat
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-14-0/intrastat-extrastat-14-0-product_harmonized_system
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-15-0/intrastat-extrastat-15-0-product_harmonized_system
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/227/14.0
:target: https://runbot.odoo-community.org/runbot/227/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -56,7 +56,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/intrastat-extrastat/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20product_harmonized_system%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20product_harmonized_system%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -101,6 +101,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-alexis-via| |maintainer-luc-demeyer|
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/14.0/product_harmonized_system>`_ project on GitHub.
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/15.0/product_harmonized_system>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,6 +1,7 @@
# Copyright 2018-2020 brain-tec AG (http://www.braintec-group.com)
# Copyright 2011-2020 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2022 Tecnativa - Víctor Martínez
# @author Benjamin Henquet <info@noviat.com>
# @author Kumar Aberer <kumar.aberer@braintec-group.com>
# @author Alexis de Lattre <alexis.delattre@akretion.com>
@@ -9,7 +10,7 @@
{
"name": "Product Harmonized System Codes",
"version": "14.0.2.3.0",
"version": "15.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3",
"summary": "Base module for Product Import/Export reports",

View File

@@ -252,9 +252,3 @@ msgstr "Unidades de almacenamiento"
#: model:ir.model.constraint,message:product_harmonized_system.constraint_hs_code_local_code_company_uniq
msgid "This code already exists for this company !"
msgstr "Este código ya existe para esta compañía !"
#~ msgid "<span class=\"o_stat_text\"> Product Categs</span>"
#~ msgstr "<span class=\"o_stat_text\"> Categs Producto</span>"
#~ msgid "<span class=\"o_stat_text\"> Products</span>"
#~ msgstr "<span class=\"o_stat_text\"> Productos</span>"

View File

@@ -253,16 +253,3 @@ msgstr "Unités de stockage"
#: model:ir.model.constraint,message:product_harmonized_system.constraint_hs_code_local_code_company_uniq
msgid "This code already exists for this company !"
msgstr "Ce code existe déjà pour cette société !"
#~ msgid ""
#~ "Code used for the national Import/Export declaration. e.g. Intrastat for "
#~ "the European Union"
#~ msgstr ""
#~ "Code utilisé pour la déclaration nationale d'import/export, par exemple "
#~ "la DEB pour la France"
#~ msgid "HS Code"
#~ msgstr "Code S.H."
#~ msgid "HS Codes"
#~ msgstr "Codes S.H."

View File

@@ -1,45 +0,0 @@
# Copyright 2021 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api
def migrate(cr, version):
if not version:
return
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
pc_field_id = env.ref(
"product_harmonized_system.field_product_category__hs_code_id"
).id
cr.execute(
"""
UPDATE product_category pc
SET hs_code_id=SUBSTRING(ip.value_reference, 9, 99)::int
FROM ir_property ip
WHERE ip.res_id like 'product.category,%%' AND
SUBSTRING(ip.res_id, 18, 99)::int=pc.id AND
ip.name='hs_code_id' AND
ip.value_reference IS NOT null AND
ip.fields_id=%s
""",
(pc_field_id,),
)
pt_field_id = env.ref(
"product_harmonized_system.field_product_template__hs_code_id"
).id
cr.execute(
"""
UPDATE product_template pt
SET hs_code_id=SUBSTRING(ip.value_reference, 9, 99)::int
FROM ir_property ip
WHERE ip.res_id like 'product.template,%%' AND
SUBSTRING(ip.res_id, 18, 99)::int=pt.id AND
ip.name='hs_code_id' AND
ip.value_reference IS NOT null AND
ip.fields_id=%s
""",
(pt_field_id,),
)

View File

@@ -4,6 +4,8 @@
# @author Luc de Meyer <info@noviat.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from textwrap import shorten
from odoo import api, fields, models
@@ -81,7 +83,7 @@ class HSCode(models.Model):
name = this.local_code
if this.description:
name += " " + this.description
name = len(name) > 55 and name[:55] + "..." or name
name = shorten(name, 55)
res.append((this.id, name))
return res

View File

@@ -13,9 +13,6 @@ class ProductCategory(models.Model):
hs_code_id = fields.Many2one(
"hs.code",
string="H.S. Code",
# company_dependent updated from True to False in 14.0.2.0.0
# migration scripts provided
company_dependent=False,
ondelete="restrict",
help="Harmonised System Code. If this code is not "
"set on the product itself, it will be read here, on the "

View File

@@ -13,9 +13,6 @@ class ProductTemplate(models.Model):
hs_code_id = fields.Many2one(
"hs.code",
string="H.S. Code",
# company_dependent updated from True to False in 14.0.2.0.0
# migration scripts provided
company_dependent=False,
ondelete="restrict",
help="Harmonised System Code. Nomenclature is "
"available from the World Customs Organisation, see "

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Product Harmonized System Codes</title>
<style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/14.0/product_harmonized_system"><img alt="OCA/intrastat-extrastat" src="https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/intrastat-extrastat-14-0/intrastat-extrastat-14-0-product_harmonized_system"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/227/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/15.0/product_harmonized_system"><img alt="OCA/intrastat-extrastat" src="https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/intrastat-extrastat-15-0/intrastat-extrastat-15-0-product_harmonized_system"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/227/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module contains the objects for Harmonised System Codes (H.S. codes). The full nomenclature is available from the <cite>World Customs Organisation &lt;http://www.wcoomd.org/&gt;</cite>. These codes are usually required on the Proforma invoices that are attached to the packages that are shipped abroad.</p>
<p>This module also handles the local/national extensions to the H.S. codes. The import of the full nomenclature is not provided by this module; it should be provided by localization modules.</p>
<p>You will also be able to configure the <em>country of origin</em> of a product, which is often required on the proforma invoice for the customs.</p>
@@ -400,7 +400,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20product_harmonized_system%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20product_harmonized_system%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -430,7 +430,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external" href="https://github.com/alexis-via"><img alt="alexis-via" src="https://github.com/alexis-via.png?size=40px" /></a> <a class="reference external" href="https://github.com/luc-demeyer"><img alt="luc-demeyer" src="https://github.com/luc-demeyer.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/14.0/product_harmonized_system">OCA/intrastat-extrastat</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/15.0/product_harmonized_system">OCA/intrastat-extrastat</a> project on GitHub.</p>
<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>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2020 Akretion France (http://www.akretion.com/)
Copyright 2010-2021 Akretion France (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -10,7 +10,7 @@
<field name="name">hs.code.search</field>
<field name="model">hs.code</field>
<field name="arch" type="xml">
<search string="Search H.S. Codes">
<search>
<field
name="local_code"
filter_domain="['|', ('local_code', 'like', self), ('description', 'ilike', self)]"
@@ -28,7 +28,7 @@
<field name="name">hs.code.tree</field>
<field name="model">hs.code</field>
<field name="arch" type="xml">
<tree string="H.S. Codes">
<tree>
<field name="hs_code" />
<field name="local_code" />
<field name="description" />
@@ -54,7 +54,7 @@
<field name="name">hs.code.form</field>
<field name="model">hs.code</field>
<field name="arch" type="xml">
<form string="H.S. Code">
<form>
<sheet>
<field name="active" invisible="1" />
<widget