diff --git a/intrastat_product_generic/__manifest__.py b/intrastat_product_generic/__manifest__.py
index cd82158..e261070 100644
--- a/intrastat_product_generic/__manifest__.py
+++ b/intrastat_product_generic/__manifest__.py
@@ -3,13 +3,13 @@
{
'name': 'Generic Intrastat Product Declaration',
- 'version': '11.0.1.0.0',
+ 'version': '12.0.1.0.0',
'category': 'Accounting & Finance',
'website': 'https://github.com/OCA/intrastat',
'author': 'Noviat,'
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
- 'installable': False,
+ 'installable': True,
'depends': [
'intrastat_product',
],
diff --git a/intrastat_product_generic/readme/CONTRIBUTORS.rst b/intrastat_product_generic/readme/CONTRIBUTORS.rst
new file mode 100644
index 0000000..044d1a0
--- /dev/null
+++ b/intrastat_product_generic/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
+* Luc De Meyer
diff --git a/intrastat_product_generic/readme/DESCRIPTION.rst b/intrastat_product_generic/readme/DESCRIPTION.rst
new file mode 100644
index 0000000..22680af
--- /dev/null
+++ b/intrastat_product_generic/readme/DESCRIPTION.rst
@@ -0,0 +1,2 @@
+This module adds a menu entry for a Generic Intrastat Product Declaration.
+This is useful to cover countries for which there is no localization module.
diff --git a/intrastat_product_generic/security/intrastat_security.xml b/intrastat_product_generic/security/intrastat_security.xml
index d4bb8a0..5948c81 100644
--- a/intrastat_product_generic/security/intrastat_security.xml
+++ b/intrastat_product_generic/security/intrastat_security.xml
@@ -5,7 +5,7 @@
Generic Intrastat Product Declaration
-
+
diff --git a/intrastat_product_generic/views/intrastat_product.xml b/intrastat_product_generic/views/intrastat_product.xml
index 631a261..91d46f8 100644
--- a/intrastat_product_generic/views/intrastat_product.xml
+++ b/intrastat_product_generic/views/intrastat_product.xml
@@ -4,7 +4,7 @@
Generic Intrastat Product Declarationintrastat.product.declaration
- tree,form,graph
+ tree,form,graph,pivot{'generic_intrastat_product_declaration': 1}
diff --git a/product_harmonized_system/__manifest__.py b/product_harmonized_system/__manifest__.py
index c05779d..4457d2d 100644
--- a/product_harmonized_system/__manifest__.py
+++ b/product_harmonized_system/__manifest__.py
@@ -8,14 +8,14 @@
{
'name': 'Product Harmonized System Codes',
- 'version': '11.0.1.0.0',
+ 'version': '12.0.1.0.0',
'category': 'Reporting',
'license': 'AGPL-3',
'summary': 'Base module for Product Import/Export reports',
'author': 'brain-tec AG, Akretion, Noviat, '
'Odoo Community Association (OCA)',
'depends': ['product'],
- 'conflicts': ['report_intrastat'],
+ 'excludes': ['account_intrastat'],
'data': [
'security/product_hs_security.xml',
'security/ir.model.access.csv',
@@ -26,5 +26,5 @@
'demo': [
'demo/product_demo.xml',
],
- 'installable': False,
+ 'installable': True,
}
diff --git a/product_harmonized_system/demo/product_demo.xml b/product_harmonized_system/demo/product_demo.xml
index dbc475f..423f67d 100644
--- a/product_harmonized_system/demo/product_demo.xml
+++ b/product_harmonized_system/demo/product_demo.xml
@@ -1,6 +1,6 @@
@@ -53,12 +53,6 @@
0.67
-
-
-
- 0.75
-
-
diff --git a/product_harmonized_system/models/hs_code.py b/product_harmonized_system/models/hs_code.py
index aaa41a8..ec3c1f8 100644
--- a/product_harmonized_system/models/hs_code.py
+++ b/product_harmonized_system/models/hs_code.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2016 Akretion (http://www.akretion.com)
+# Copyright 2011-2016 Akretion France (http://www.akretion.com)
# Copyright 2009-2016 Noviat (http://www.noviat.com)
# @author Alexis de Lattre
# @author Luc de Meyer
@@ -11,7 +11,7 @@ class HSCode(models.Model):
_name = "hs.code"
_description = "H.S. Code"
_order = "local_code"
- _rec_name = "display_name"
+ _rec_name = "local_code"
hs_code = fields.Char(
string='H.S. Code', compute='_compute_hs_code', readonly=True,
@@ -21,9 +21,6 @@ class HSCode(models.Model):
description = fields.Char(
translate=True,
help="Short text description of the H.S. category")
- display_name = fields.Char(
- compute='_compute_display_name_field',
- store=True, readonly=True)
local_code = fields.Char(
required=True,
help="Code used for the national Import/Export declaration. "
@@ -32,8 +29,7 @@ class HSCode(models.Model):
active = fields.Boolean(default=True)
company_id = fields.Many2one(
'res.company', string='Company', readonly=True, required=True,
- default=lambda self: self.env['res.company']._company_default_get(
- 'hs.code'))
+ default=lambda self: self.env['res.company']._company_default_get())
product_categ_ids = fields.One2many(
comodel_name='product.category',
inverse_name='hs_code_id',
@@ -44,23 +40,39 @@ class HSCode(models.Model):
inverse_name='hs_code_id',
string='Products',
readonly=True)
+ product_categ_count = fields.Integer(
+ compute='_compute_product_categ_count')
+ product_tmpl_count = fields.Integer(compute='_compute_product_tmpl_count')
- @api.multi
@api.depends('local_code')
def _compute_hs_code(self):
for this in self:
this.hs_code = this.local_code and this.local_code[:6]
- @api.multi
+ @api.depends('product_categ_ids')
+ def _compute_product_categ_count(self):
+ # hs_code_id on product.category is company_dependent=True
+ # so we can't use a read_group()
+ for code in self:
+ code.product_categ_count = len(code.product_categ_ids)
+
+ @api.depends('product_tmpl_ids')
+ def _compute_product_tmpl_count(self):
+ # hs_code_id on product.template is company_dependent=True
+ # so we can't use a read_group()
+ for code in self:
+ code.product_tmpl_count = len(code.product_tmpl_ids)
+
@api.depends('local_code', 'description')
- def _compute_display_name_field(self):
+ def name_get(self):
+ res = []
for this in self:
- display_name = this.local_code
+ name = this.local_code
if this.description:
- display_name += ' ' + this.description
- this.display_name = len(display_name) > 55 \
- and display_name[:55] + '...' \
- or display_name
+ name += ' ' + this.description
+ name = len(name) > 55 and name[:55] + '...' or name
+ res.append((this.id, name))
+ return res
_sql_constraints = [
('local_code_company_uniq', 'unique(local_code, company_id)',
@@ -73,7 +85,6 @@ class HSCode(models.Model):
vals['local_code'] = vals['local_code'].replace(' ', '')
return super(HSCode, self).create(vals)
- @api.multi
def write(self, vals):
if vals.get('local_code'):
vals['local_code'] = vals['local_code'].replace(' ', '')
diff --git a/product_harmonized_system/models/product_category.py b/product_harmonized_system/models/product_category.py
index c34bb9f..90b7882 100644
--- a/product_harmonized_system/models/product_category.py
+++ b/product_harmonized_system/models/product_category.py
@@ -1,10 +1,10 @@
-# Copyright 2011-2016 Akretion (http://www.akretion.com)
+# Copyright 2011-2016 Akretion France (http://www.akretion.com)
# Copyright 2009-2016 Noviat (http://www.noviat.com)
# @author Alexis de Lattre
# @author Luc de Meyer
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import fields, models
class ProductCategory(models.Model):
@@ -17,7 +17,6 @@ class ProductCategory(models.Model):
"set on the product itself, it will be read here, on the "
"related product category.")
- @api.multi
def get_hs_code_recursively(self):
self.ensure_one()
if self.hs_code_id:
diff --git a/product_harmonized_system/models/product_template.py b/product_harmonized_system/models/product_template.py
index eac6b4d..8bbb506 100644
--- a/product_harmonized_system/models/product_template.py
+++ b/product_harmonized_system/models/product_template.py
@@ -4,7 +4,7 @@
# @author Luc de Meyer
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import fields, models
class ProductTemplate(models.Model):
@@ -26,15 +26,12 @@ class ProductTemplate(models.Model):
class ProductProduct(models.Model):
_inherit = 'product.product'
- @api.multi
def get_hs_code_recursively(self):
res = self.env['hs.code']
- if not self:
- return res
- else:
+ if self:
self.ensure_one()
if self.hs_code_id:
res = self.hs_code_id
elif self.categ_id:
res = self.categ_id.get_hs_code_recursively()
- return res
+ return res
diff --git a/product_harmonized_system/readme/CONTRIBUTORS.rst b/product_harmonized_system/readme/CONTRIBUTORS.rst
new file mode 100644
index 0000000..439f3b3
--- /dev/null
+++ b/product_harmonized_system/readme/CONTRIBUTORS.rst
@@ -0,0 +1,3 @@
+* Alexis de Lattre, Akretion
+* Luc De Meyer, Noviat
+* Kumar Aberer, brain-tec AG
diff --git a/product_harmonized_system/readme/DESCRIPTION.rst b/product_harmonized_system/readme/DESCRIPTION.rst
new file mode 100644
index 0000000..a89dae6
--- /dev/null
+++ b/product_harmonized_system/readme/DESCRIPTION.rst
@@ -0,0 +1,69 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+
+============================================
+Harmonized System Codes (and National Codes)
+============================================
+
+This module contains the objects for Harmonised System Codes (H.S. codes). The full nomenclature is available from the `World Customs Organisation `. These code are usually required on the Proforma invoices that are attached to the packages that are shipped abroad.
+
+This module also handle 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.
+
+You will also be able to configure the country of origin of a product, which is often required on the proforma invoice for the customs.
+
+This module should be usefull for all companies that export physical goods abroad. This module is also used by the Intrastat modules for the European Union, cf the *intrastat_product* module.
+
+
+Installation
+============
+
+This module is NOT compatible with the *report_intrastat* module from the official addons.
+
+
+Usage
+=====
+
+To create H.S. codes, go to the menu *Sales > Configuration > Product Categories and Attributes > H.S. Codes*.
+
+Then you will be able to set the H.S. code on an product (under the *Information* tab) or on a product category. On the product form, you will also be able to set the *Country of Origin* of a product (for example, if the product is *made in China*, select *China* as *Country of Origin*).
+
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/227/11.0
+
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub 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.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Alexis de Lattre, Akretion
+* Luc De Meyer, Noviat
+* Kumar Aberer, brain-tec AG
+
+Maintainer
+----------
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+This module is maintained by the OCA.
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
+To contribute to this module, please visit https://odoo-community.org.
diff --git a/product_harmonized_system/readme/INSTALL.rst b/product_harmonized_system/readme/INSTALL.rst
new file mode 100644
index 0000000..5b11a6a
--- /dev/null
+++ b/product_harmonized_system/readme/INSTALL.rst
@@ -0,0 +1 @@
+This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.
diff --git a/product_harmonized_system/readme/USAGE.rst b/product_harmonized_system/readme/USAGE.rst
new file mode 100644
index 0000000..7d955cd
--- /dev/null
+++ b/product_harmonized_system/readme/USAGE.rst
@@ -0,0 +1,3 @@
+As this module only depends on the *product* module and that module doesn't provide any menu entry, this module lacks a menu entry for H.S. Codes. A menu entry for H.S. codes is provided by the module *product_harmonized_system_stock*.
+
+Once the H.S. codes are created, you will be able to set the H.S. code on an product (under the *Information* tab) or on a product category. On the product form, you will also be able to set the *Country of Origin* of a product (for example, if the product is *made in China*, select *China* as *Country of Origin*).
diff --git a/product_harmonized_system/views/hs_code.xml b/product_harmonized_system/views/hs_code.xml
index fac22af..93a5e46 100644
--- a/product_harmonized_system/views/hs_code.xml
+++ b/product_harmonized_system/views/hs_code.xml
@@ -1,6 +1,6 @@
@@ -14,7 +14,8 @@
+ filter_domain="['|', ('local_code', 'like', self), ('description', 'ilike', self)]"/>
+
@@ -33,24 +34,57 @@
+
+
+ Product Categories
+ product.category
+ tree,form
+ [('hs_code_id', '=', active_id)]
+
+
+
+ Products
+ product.template
+ kanban,tree,form
+ [('hs_code_id', '=', active_id)]
+
+
hs.code.formhs.code
@@ -63,10 +97,7 @@
tree,form
-
-
+
diff --git a/product_harmonized_system/views/product_category.xml b/product_harmonized_system/views/product_category.xml
index ac75e13..7d74d60 100644
--- a/product_harmonized_system/views/product_category.xml
+++ b/product_harmonized_system/views/product_category.xml
@@ -1,6 +1,6 @@
diff --git a/product_harmonized_system/views/product_template.xml b/product_harmonized_system/views/product_template.xml
index cc0ebcb..fc82e46 100644
--- a/product_harmonized_system/views/product_template.xml
+++ b/product_harmonized_system/views/product_template.xml
@@ -1,6 +1,6 @@
diff --git a/product_harmonized_system_delivery/__manifest__.py b/product_harmonized_system_delivery/__manifest__.py
index a0945e5..4813b4d 100644
--- a/product_harmonized_system_delivery/__manifest__.py
+++ b/product_harmonized_system_delivery/__manifest__.py
@@ -4,13 +4,14 @@
{
'name': 'Product Harmonized System Codes - Delivery',
- 'version': '11.0.1.0.0',
+ 'version': '12.0.1.0.0',
'category': 'Reporting',
'license': 'AGPL-3',
- 'summary': 'Hide native hs_code field provided by the delivery module',
+ 'summary': 'Hide native hs_code field provided by the delivery_hs_code '
+ 'module',
'author': 'Akretion, Odoo Community Association (OCA)',
- 'depends': ['delivery', 'product_harmonized_system'],
+ 'depends': ['delivery_hs_code', 'product_harmonized_system'],
'data': ['views/product_template.xml'],
- 'installable': False,
+ 'installable': True,
'auto_install': True,
}
diff --git a/product_harmonized_system_delivery/readme/DESCRIPTION.rst b/product_harmonized_system_delivery/readme/DESCRIPTION.rst
index ecd76ab..d625c6a 100644
--- a/product_harmonized_system_delivery/readme/DESCRIPTION.rst
+++ b/product_harmonized_system_delivery/readme/DESCRIPTION.rst
@@ -1 +1 @@
-The OCA module *product_harmonized_system* adds a many2one field *hs_code_id* on product templates that points to an *H.S. Code* object. But the *delivery* module from the official addons adds a char field *hs_code* on product templates, which has the same purpose, but we can't use it because we need structured data for H.S. codes. This module hides the *hs_code* field added by the *delivery* module, to avoid confusion.
+The OCA module *product_harmonized_system* adds a many2one field *hs_code_id* on product templates that points to an *H.S. Code* object. But the *delivery_hs_code* module from the official addons (an auto-install module that depends on *delivery*) adds a char field *hs_code* on product templates, which has the same purpose, but we can't use it because we need structured data for H.S. codes. This module hides the *hs_code* field added by the *delivery_hs_code* module, to avoid confusion.
diff --git a/product_harmonized_system_delivery/views/product_template.xml b/product_harmonized_system_delivery/views/product_template.xml
index d9a6695..13df8dd 100644
--- a/product_harmonized_system_delivery/views/product_template.xml
+++ b/product_harmonized_system_delivery/views/product_template.xml
@@ -11,7 +11,7 @@
hide_native_hs_code_field.product.template.formproduct.template
-
+ 1
diff --git a/product_harmonized_system_stock/__init__.py b/product_harmonized_system_stock/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/product_harmonized_system_stock/__manifest__.py b/product_harmonized_system_stock/__manifest__.py
new file mode 100644
index 0000000..b5622b6
--- /dev/null
+++ b/product_harmonized_system_stock/__manifest__.py
@@ -0,0 +1,18 @@
+# Copyright 2019 Akretion (http://www.akretion.com)
+# @author Alexis de Lattre
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ 'name': 'Product Harmonized System (menu entry)',
+ 'version': '12.0.1.0.0',
+ 'category': 'Reporting',
+ 'license': 'AGPL-3',
+ 'summary': 'Adds a menu entry for H.S. codes',
+ 'author': 'Akretion, Odoo Community Association (OCA)',
+ 'depends': ['product_harmonized_system', 'stock'],
+ 'data': [
+ 'views/hs_code_menu.xml',
+ ],
+ 'installable': True,
+ 'auto_install': True,
+}
diff --git a/product_harmonized_system_stock/readme/CONTRIBUTORS.rst b/product_harmonized_system_stock/readme/CONTRIBUTORS.rst
new file mode 100644
index 0000000..ff65d68
--- /dev/null
+++ b/product_harmonized_system_stock/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
+* Alexis de Lattre
diff --git a/product_harmonized_system_stock/readme/DESCRIPTION.rst b/product_harmonized_system_stock/readme/DESCRIPTION.rst
new file mode 100644
index 0000000..dedcde1
--- /dev/null
+++ b/product_harmonized_system_stock/readme/DESCRIPTION.rst
@@ -0,0 +1 @@
+This module adds a menu entry for H.S. Codes. This menu entry is available under *Inventory > Configuration > Products*.
diff --git a/product_harmonized_system_stock/views/hs_code_menu.xml b/product_harmonized_system_stock/views/hs_code_menu.xml
new file mode 100644
index 0000000..483b170
--- /dev/null
+++ b/product_harmonized_system_stock/views/hs_code_menu.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+