diff --git a/nfu_product_bnn_attributes/README.rst b/nfu_product_bnn_attributes/README.rst index 4da0457..2a8c650 100644 --- a/nfu_product_bnn_attributes/README.rst +++ b/nfu_product_bnn_attributes/README.rst @@ -39,6 +39,7 @@ Changelog - 16.0.1.2.0: Add Multi company to packaging - 16.0.1.2.1: Always write the company in the product packaging - 16.0.1.2.2: Enable Unit of Measure on installation +- 16.0.1.3.0: Add GTIN Article field and update metadata retrieval Bug Tracker =========== diff --git a/nfu_product_bnn_attributes/__manifest__.py b/nfu_product_bnn_attributes/__manifest__.py index 2c07fac..5a275e9 100644 --- a/nfu_product_bnn_attributes/__manifest__.py +++ b/nfu_product_bnn_attributes/__manifest__.py @@ -4,8 +4,8 @@ "author": "BAKEUP", "website": "https://www.bakeup.org", "category": "Product", - "version": "16.0.1.2.2", - "depends": ["nfu_product"], + "version": "16.0.1.3.0", + "depends": ["nfu_product", "data_nature_importer"], "data": ["data/ir_config_parameter.xml", "views/product_bnn_views.xml"], "assets": {}, "license": "LGPL-3", diff --git a/nfu_product_bnn_attributes/models/product_template.py b/nfu_product_bnn_attributes/models/product_template.py index b5e15c3..0f6f937 100644 --- a/nfu_product_bnn_attributes/models/product_template.py +++ b/nfu_product_bnn_attributes/models/product_template.py @@ -1,5 +1,7 @@ from odoo import fields, models +from odoo.addons.data_nature_importer.utils import get_datanature_metadata + class ProductTemplate(models.Model): _inherit = "product.template" @@ -11,6 +13,15 @@ class ProductTemplate(models.Model): origin = fields.Char() packaging_qty = fields.Float(string="Packaging Quantity") packaging_name = fields.Char() + gtin_article = fields.Char(string="Article GTIN") + + def _get_dn_metadata(self): + self.ensure_one() + if self.gtin_article: + metadata = get_datanature_metadata(self, self.gtin_article) + if metadata: + return metadata[0] + return super()._get_dn_metadata() def write(self, vals): res = super().write(vals) diff --git a/nfu_product_bnn_attributes/readme/HISTORY.rst b/nfu_product_bnn_attributes/readme/HISTORY.rst index 1d5f755..1099530 100644 --- a/nfu_product_bnn_attributes/readme/HISTORY.rst +++ b/nfu_product_bnn_attributes/readme/HISTORY.rst @@ -4,4 +4,5 @@ - 16.0.1.1.1: inherit package company if from product - 16.0.1.2.0: Add Multi company to packaging - 16.0.1.2.1: Always write the company in the product packaging -- 16.0.1.2.2: Enable Unit of Measure on installation \ No newline at end of file +- 16.0.1.2.2: Enable Unit of Measure on installation +- 16.0.1.3.0: Add GTIN Article field and update metadata retrieval \ No newline at end of file diff --git a/nfu_product_bnn_attributes/static/description/index.html b/nfu_product_bnn_attributes/static/description/index.html index f535625..95367fa 100644 --- a/nfu_product_bnn_attributes/static/description/index.html +++ b/nfu_product_bnn_attributes/static/description/index.html @@ -393,6 +393,7 @@ ul.auto-toc {
  • 16.0.1.2.0: Add Multi company to packaging
  • 16.0.1.2.1: Always write the company in the product packaging
  • 16.0.1.2.2: Enable Unit of Measure on installation
  • +
  • 16.0.1.3.0: Add GTIN Article field and update metadata retrieval
  • diff --git a/nfu_product_bnn_attributes/views/product_bnn_views.xml b/nfu_product_bnn_attributes/views/product_bnn_views.xml index 283260f..2f60c03 100644 --- a/nfu_product_bnn_attributes/views/product_bnn_views.xml +++ b/nfu_product_bnn_attributes/views/product_bnn_views.xml @@ -10,6 +10,7 @@ +