From bfb971136024db02efc66a35f1fc488733a54e26 Mon Sep 17 00:00:00 2001 From: Ajmal JK Date: Thu, 19 Mar 2020 11:42:38 +0530 Subject: [PATCH] [FIX] Bug Fixed 'inventory_barcode_scanning' --- inventory_barcode_scanning/__manifest__.py | 2 +- inventory_barcode_scanning/doc/RELEASE_NOTES.md | 5 +++++ inventory_barcode_scanning/models/stock_picking.py | 13 ++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/inventory_barcode_scanning/__manifest__.py b/inventory_barcode_scanning/__manifest__.py index 37a39e6fa..1a5fff569 100644 --- a/inventory_barcode_scanning/__manifest__.py +++ b/inventory_barcode_scanning/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Barcode scanning in Inventory', - 'version': '13.0.1.0.0', + 'version': '13.0.1.0.1', 'summary': 'Barcode Support in Stock Picking.', 'author': 'Cybrosys Techno solutions', 'maintainer': 'Cybrosys Techno Solutions', diff --git a/inventory_barcode_scanning/doc/RELEASE_NOTES.md b/inventory_barcode_scanning/doc/RELEASE_NOTES.md index bb5b783ca..c8d40fa19 100644 --- a/inventory_barcode_scanning/doc/RELEASE_NOTES.md +++ b/inventory_barcode_scanning/doc/RELEASE_NOTES.md @@ -5,5 +5,10 @@ #### ADD Initial commit for Barcode scanning in Inventory +#### 19.03.2020 +#### Version 13.0.1.0.1 +#### FIX +Bug Fixed + diff --git a/inventory_barcode_scanning/models/stock_picking.py b/inventory_barcode_scanning/models/stock_picking.py index c8f6d547d..94a379bfe 100644 --- a/inventory_barcode_scanning/models/stock_picking.py +++ b/inventory_barcode_scanning/models/stock_picking.py @@ -35,20 +35,27 @@ class StockPicking(models.Model): product_obj = self.env['product.product'] product_id = product_obj.search([('barcode', '=', self.barcode)]) if self.barcode and not product_id: - self.barcode = None raise Warning('No product is available for this barcode') if self.barcode and self.move_ids_without_package: for line in self.move_ids_without_package: if line.product_id.barcode == self.barcode: line.quantity_done += 1 - self.barcode = None match = True if self.barcode and not match: - self.barcode = None if product_id: raise Warning('This product is not available in the order.' 'You can add this product by clicking the "Add an item" and scan') + def write(self, vals): + res = super(StockPicking, self).write(vals) + if vals.get('barcode') and self.move_ids_without_package: + for line in self.move_ids_without_package: + if line.product_id.barcode == vals['barcode']: + print(line.quantity_done) + line.quantity_done += 1 + self.barcode = None + return res + class StockPickingOperation(models.Model): _inherit = 'stock.move'