diff --git a/addons/barcodes/models/barcode_nomenclature.py b/addons/barcodes/models/barcode_nomenclature.py index c72e2ac6c5a..5a9605c9140 100644 --- a/addons/barcodes/models/barcode_nomenclature.py +++ b/addons/barcodes/models/barcode_nomenclature.py @@ -63,6 +63,7 @@ class BarcodeNomenclature(models.Model): barcode_sizes = { 'ean8': 8, 'ean13': 13, + 'gtin14': 14, 'upca': 12, } barcode_size = barcode_sizes[encoding] diff --git a/addons/product_expiry/__manifest__.py b/addons/product_expiry/__manifest__.py index 60f3822367e..2ca9b2d4e30 100644 --- a/addons/product_expiry/__manifest__.py +++ b/addons/product_expiry/__manifest__.py @@ -27,6 +27,7 @@ Also implements the removal strategy First Expiry First Out (FEFO) widely used, 'wizard/confirm_expiry_view.xml', 'report/report_deliveryslip.xml', 'report/report_lot_barcode.xml', + 'report/report_package_barcode.xml', 'data/product_expiry_data.xml'], 'license': 'LGPL-3', } diff --git a/addons/product_expiry/report/report_package_barcode.xml b/addons/product_expiry/report/report_package_barcode.xml new file mode 100644 index 00000000000..030fcf7873a --- /dev/null +++ b/addons/product_expiry/report/report_package_barcode.xml @@ -0,0 +1,10 @@ + + + diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 282e41759c5..f36f2a2203d 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -101,12 +101,20 @@ class Product(models.Model): storage_category_capacity_ids = fields.One2many('stock.storage.category.capacity', 'product_id', 'Storage Category Capacity') show_on_hand_qty_status_button = fields.Boolean(compute='_compute_show_qty_status_button') show_forecasted_qty_status_button = fields.Boolean(compute='_compute_show_qty_status_button') + valid_ean = fields.Boolean('Barcode is valid EAN', compute='_compute_valid_ean') def _compute_show_qty_status_button(self): for product in self: product.show_on_hand_qty_status_button = product.product_tmpl_id.show_on_hand_qty_status_button product.show_forecasted_qty_status_button = product.product_tmpl_id.show_forecasted_qty_status_button + @api.depends('barcode') + def _compute_valid_ean(self): + self.valid_ean = False + for product in self: + if product.barcode: + product.valid_ean = self.env['barcode.nomenclature'].check_encoding(product.barcode.rjust(14, '0'), 'gtin14') + @api.depends('stock_move_ids.product_qty', 'stock_move_ids.state') @api.depends_context( 'lot_id', 'owner_id', 'package_id', 'from_date', 'to_date', diff --git a/addons/stock/report/report_package_barcode.xml b/addons/stock/report/report_package_barcode.xml index a3a4a71491a..5f02d0a2906 100644 --- a/addons/stock/report/report_package_barcode.xml +++ b/addons/stock/report/report_package_barcode.xml @@ -24,14 +24,16 @@

- +
+ + @@ -48,6 +50,15 @@ +
Product Quantity Lot/Serial Number
+ + + + + + + +