From 192abc4ca740be26c76bd05b029bc875ca8425f3 Mon Sep 17 00:00:00 2001 From: Ajmal JK Date: Wed, 1 Jan 2020 09:17:50 +0530 Subject: [PATCH] [FIX] Bug Fixed 'product_barcode' --- product_barcode/__manifest__.py | 2 +- product_barcode/doc/RELEASE_NOTES.md | 5 +++++ product_barcode/models/product_form.py | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/product_barcode/__manifest__.py b/product_barcode/__manifest__.py index 531fa7d91..765360018 100644 --- a/product_barcode/__manifest__.py +++ b/product_barcode/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Product Barcode Generator', - 'version': '13.0.1.1.0', + 'version': '13.0.1.2.0', 'summary': 'Generates EAN13 Standard Barcode for Product.', 'category': 'Inventory', 'author': 'Cybrosys Techno solutions', diff --git a/product_barcode/doc/RELEASE_NOTES.md b/product_barcode/doc/RELEASE_NOTES.md index 576479e72..e8c4072a6 100644 --- a/product_barcode/doc/RELEASE_NOTES.md +++ b/product_barcode/doc/RELEASE_NOTES.md @@ -9,3 +9,8 @@ #### Version 13.0.1.1.0 ##### FIX - Bug Fixed + +#### 12.31.2019 +#### Version 13.0.1.2.0 +##### FIX +- Bug Fixed diff --git a/product_barcode/models/product_form.py b/product_barcode/models/product_form.py index 990260216..6d25c0221 100644 --- a/product_barcode/models/product_form.py +++ b/product_barcode/models/product_form.py @@ -32,8 +32,8 @@ class ProductAutoBarcode(models.Model): def create(self, vals): res = super(ProductAutoBarcode, self).create(vals) ean = generate_ean(str(res.id)) - res.barcode = ean + print("res.barcode",res.barcode) return res @@ -83,4 +83,16 @@ def generate_ean(ean): ean = ean + '0' * (13 - len(ean)) return ean[:-1] + str(ean_checksum(ean)) + +class ProductTemplateAutoBarcode(models.Model): + _inherit = 'product.template' + + @api.model + def create(self, vals_list): + templates = super(ProductTemplateAutoBarcode, self).create(vals_list) + ean = generate_ean(str(templates.id)) + templates.barcode = ean + return templates + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: