[255] nfu_product_bnn_attributes: Add GTIN Article field and update metadata retrieval
This commit is contained in:
parent
483787a0cf
commit
3efc767c42
6 changed files with 18 additions and 3 deletions
|
|
@ -39,6 +39,7 @@ Changelog
|
||||||
- 16.0.1.2.0: Add Multi company to packaging
|
- 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.1: Always write the company in the product packaging
|
||||||
- 16.0.1.2.2: Enable Unit of Measure on installation
|
- 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
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
"author": "BAKEUP",
|
"author": "BAKEUP",
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "Product",
|
"category": "Product",
|
||||||
"version": "16.0.1.2.2",
|
"version": "16.0.1.3.0",
|
||||||
"depends": ["nfu_product"],
|
"depends": ["nfu_product", "data_nature_importer"],
|
||||||
"data": ["data/ir_config_parameter.xml", "views/product_bnn_views.xml"],
|
"data": ["data/ir_config_parameter.xml", "views/product_bnn_views.xml"],
|
||||||
"assets": {},
|
"assets": {},
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
from odoo.addons.data_nature_importer.utils import get_datanature_metadata
|
||||||
|
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
|
@ -11,6 +13,15 @@ class ProductTemplate(models.Model):
|
||||||
origin = fields.Char()
|
origin = fields.Char()
|
||||||
packaging_qty = fields.Float(string="Packaging Quantity")
|
packaging_qty = fields.Float(string="Packaging Quantity")
|
||||||
packaging_name = fields.Char()
|
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):
|
def write(self, vals):
|
||||||
res = super().write(vals)
|
res = super().write(vals)
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,4 @@
|
||||||
- 16.0.1.2.0: Add Multi company to packaging
|
- 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.1: Always write the company in the product packaging
|
||||||
- 16.0.1.2.2: Enable Unit of Measure on installation
|
- 16.0.1.2.2: Enable Unit of Measure on installation
|
||||||
|
- 16.0.1.3.0: Add GTIN Article field and update metadata retrieval
|
||||||
|
|
@ -393,6 +393,7 @@ ul.auto-toc {
|
||||||
<li>16.0.1.2.0: Add Multi company to packaging</li>
|
<li>16.0.1.2.0: Add Multi company to packaging</li>
|
||||||
<li>16.0.1.2.1: Always write the company in the product packaging</li>
|
<li>16.0.1.2.1: Always write the company in the product packaging</li>
|
||||||
<li>16.0.1.2.2: Enable Unit of Measure on installation</li>
|
<li>16.0.1.2.2: Enable Unit of Measure on installation</li>
|
||||||
|
<li>16.0.1.3.0: Add GTIN Article field and update metadata retrieval</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<group>
|
<group>
|
||||||
<group name="bnn_information">
|
<group name="bnn_information">
|
||||||
<field name="manufacturer_abbr"/>
|
<field name="manufacturer_abbr"/>
|
||||||
|
<field name="gtin_article"/>
|
||||||
<field name="additional_information"/>
|
<field name="additional_information"/>
|
||||||
<field name="quality"/>
|
<field name="quality"/>
|
||||||
<field name="origin"/>
|
<field name="origin"/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue