Browse Source

[FIX] Bug Fixed 'inventory_barcode_scanning'

pull/145/head
Ajmal JK 5 years ago
parent
commit
bfb9711360
  1. 2
      inventory_barcode_scanning/__manifest__.py
  2. 5
      inventory_barcode_scanning/doc/RELEASE_NOTES.md
  3. 13
      inventory_barcode_scanning/models/stock_picking.py

2
inventory_barcode_scanning/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Barcode scanning in Inventory', 'name': 'Barcode scanning in Inventory',
'version': '13.0.1.0.0', 'version': '13.0.1.0.1',
'summary': 'Barcode Support in Stock Picking.', 'summary': 'Barcode Support in Stock Picking.',
'author': 'Cybrosys Techno solutions', 'author': 'Cybrosys Techno solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',

5
inventory_barcode_scanning/doc/RELEASE_NOTES.md

@ -5,5 +5,10 @@
#### ADD #### ADD
Initial commit for Barcode scanning in Inventory Initial commit for Barcode scanning in Inventory
#### 19.03.2020
#### Version 13.0.1.0.1
#### FIX
Bug Fixed

13
inventory_barcode_scanning/models/stock_picking.py

@ -35,20 +35,27 @@ class StockPicking(models.Model):
product_obj = self.env['product.product'] product_obj = self.env['product.product']
product_id = product_obj.search([('barcode', '=', self.barcode)]) product_id = product_obj.search([('barcode', '=', self.barcode)])
if self.barcode and not product_id: if self.barcode and not product_id:
self.barcode = None
raise Warning('No product is available for this barcode') raise Warning('No product is available for this barcode')
if self.barcode and self.move_ids_without_package: if self.barcode and self.move_ids_without_package:
for line in self.move_ids_without_package: for line in self.move_ids_without_package:
if line.product_id.barcode == self.barcode: if line.product_id.barcode == self.barcode:
line.quantity_done += 1 line.quantity_done += 1
self.barcode = None
match = True match = True
if self.barcode and not match: if self.barcode and not match:
self.barcode = None
if product_id: if product_id:
raise Warning('This product is not available in the order.' raise Warning('This product is not available in the order.'
'You can add this product by clicking the "Add an item" and scan') '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): class StockPickingOperation(models.Model):
_inherit = 'stock.move' _inherit = 'stock.move'

Loading…
Cancel
Save