Skip to content

Commit

Permalink
[MIG] product_harmonized_system to v15
Browse files Browse the repository at this point in the history
Migrate product_harmonized_system_delivery to v15
Migrate product_harmonized_system_stock to v15
  • Loading branch information
alexis-via committed Dec 16, 2021
1 parent f9ca08e commit 23b6428
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 93 deletions.
8 changes: 4 additions & 4 deletions product_harmonized_system/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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 2018-2021 brain-tec AG (http://www.braintec-group.com)
# Copyright 2011-2021 Akretion (http://www.akretion.com)
# Copyright 2009-2021 Noviat (http://www.noviat.com)
# @author Benjamin Henquet <info@noviat.com>
# @author Kumar Aberer <kumar.aberer@braintec-group.com>
# @author Alexis de Lattre <alexis.delattre@akretion.com>
Expand All @@ -9,7 +9,7 @@

{
"name": "Product Harmonized System Codes",
"version": "14.0.2.0.0",
"version": "15.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3",
"summary": "Base module for Product Import/Export reports",
Expand Down
2 changes: 1 addition & 1 deletion product_harmonized_system/demo/product_demo.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2011-2020 Akretion France (http://www.akretion.com/)
Copyright 2011-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).
-->
Expand Down
45 changes: 0 additions & 45 deletions product_harmonized_system/migrations/14.0.2.0.0/post-migration.py

This file was deleted.

14 changes: 6 additions & 8 deletions product_harmonized_system/models/hs_code.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright 2011-2020 Akretion France (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2011-2021 Akretion France (http://www.akretion.com)
# Copyright 2009-2021 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @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


Expand Down Expand Up @@ -34,7 +36,7 @@ class HSCode(models.Model):
company_id = fields.Many2one(
"res.company",
string="Company",
default=lambda self: self._default_company_id(),
# by default, company_id=False on this object
)
product_categ_ids = fields.One2many(
comodel_name="product.category",
Expand All @@ -51,10 +53,6 @@ class HSCode(models.Model):
product_categ_count = fields.Integer(compute="_compute_product_categ_count")
product_tmpl_count = fields.Integer(compute="_compute_product_tmpl_count")

@api.model
def _default_company_id(self):
return self.env.company

@api.depends("local_code")
def _compute_hs_code(self):
for this in self:
Expand All @@ -81,7 +79,7 @@ def name_get(self):
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

Expand Down
7 changes: 2 additions & 5 deletions product_harmonized_system/models/product_category.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2011-2020 Akretion France (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2011-2021 Akretion France (http://www.akretion.com)
# Copyright 2009-2021 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
Expand All @@ -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 "
Expand Down
7 changes: 2 additions & 5 deletions product_harmonized_system/models/product_template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2011-2020 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2011-2021 Akretion (http://www.akretion.com)
# Copyright 2009-2021 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
Expand All @@ -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 "
Expand Down
8 changes: 4 additions & 4 deletions product_harmonized_system/views/hs_code.xml
Original file line number Diff line number Diff line change
@@ -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).
-->
Expand All @@ -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)]"
Expand All @@ -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" />
Expand All @@ -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>
<field name="active" invisible="1" />
<widget
name="web_ribbon"
Expand Down
18 changes: 15 additions & 3 deletions product_harmonized_system/views/product_template.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?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).
-->
<odoo>
<!-- product.template form view -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">hs_code.product.template.form</field>
<field name="model">product.template</field>
Expand All @@ -22,5 +21,18 @@
/>
</field>
</field>
</record>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view" />
<field name="arch" type="xml">
<filter name="categ_id" position="after">
<filter
string="H.S. Code"
name="hs_code_groupby"
context="{'group_by': 'hs_code_id'}"
/>
</filter>
</field>
</record>
</odoo>
4 changes: 2 additions & 2 deletions product_harmonized_system_delivery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2018-2020 Akretion France (http://www.akretion.com)
# Copyright 2018-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).

{
"name": "Product Harmonized System Codes - Delivery",
"version": "14.0.1.1.0",
"version": "15.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3",
"summary": "Hide native hs_code field provided by the delivery module",
Expand Down
2 changes: 1 addition & 1 deletion product_harmonized_system_delivery/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import product
from . import product_template
11 changes: 0 additions & 11 deletions product_harmonized_system_delivery/models/product.py

This file was deleted.

10 changes: 10 additions & 0 deletions product_harmonized_system_delivery/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2017-2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

hs_code = fields.Char(related="hs_code_id.hs_code", store=True)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2018-2020 Akretion France (http://www.akretion.com/)
Copyright 2018-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).
-->
Expand Down
4 changes: 2 additions & 2 deletions product_harmonized_system_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2019-2020 Akretion France (http://www.akretion.com)
# Copyright 2019-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).

{
"name": "Product Harmonized System (menu entry)",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3",
"summary": "Adds a menu entry for H.S. codes",
Expand Down
2 changes: 1 addition & 1 deletion product_harmonized_system_stock/views/hs_code_menu.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2019-2020 Akretion France (http://www.akretion.com/)
Copyright 2019-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).
-->
Expand Down
6 changes: 6 additions & 0 deletions setup/product_harmonized_system/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/product_harmonized_system_delivery/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/product_harmonized_system_stock/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 23b6428

Please sign in to comment.