Add stock_inventory_consumables patch
Allow to inventory consumable products issue #028587
This commit is contained in:
parent
569e7f115e
commit
59fc223b14
1
series
1
series
|
@ -116,3 +116,4 @@ account_payment_clearing-set_party.diff
|
||||||
issue4912.diff
|
issue4912.diff
|
||||||
issue5847.diff
|
issue5847.diff
|
||||||
lock_stock_move.diff
|
lock_stock_move.diff
|
||||||
|
stock_inventory_consumables.diff
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
diff -r 875ff56c92cb inventory.py
|
||||||
|
--- a/trytond/trytond/modules/stock/inventory.py Mon Oct 03 12:19:14 2016 +0200
|
||||||
|
+++ b/trytond/trytond/modules/stock/inventory.py Mon Oct 03 13:06:18 2016 +0200
|
||||||
|
@@ -208,16 +208,13 @@
|
||||||
|
|
||||||
|
# Index some data
|
||||||
|
product2type = {}
|
||||||
|
- product2consumable = {}
|
||||||
|
for product in Product.browse([line[1] for line in pbl]):
|
||||||
|
product2type[product.id] = product.type
|
||||||
|
- product2consumable[product.id] = product.consumable
|
||||||
|
|
||||||
|
# Update existing lines
|
||||||
|
for line in inventory.lines:
|
||||||
|
if not (line.product.active and
|
||||||
|
- line.product.type == 'goods'
|
||||||
|
- and not line.product.consumable):
|
||||||
|
+ line.product.type == 'goods'):
|
||||||
|
Line.delete([line])
|
||||||
|
continue
|
||||||
|
key = (inventory.location.id,) + line.unique_key
|
||||||
|
@@ -232,8 +229,7 @@
|
||||||
|
# Create lines if needed
|
||||||
|
for key, quantity in pbl.iteritems():
|
||||||
|
product_id = key[grouping.index('product') + 1]
|
||||||
|
- if (product2type[product_id] != 'goods'
|
||||||
|
- or product2consumable[product_id]):
|
||||||
|
+ if product2type[product_id] != 'goods':
|
||||||
|
continue
|
||||||
|
if not quantity:
|
||||||
|
continue
|
||||||
|
@@ -253,7 +249,6 @@
|
||||||
|
product = fields.Many2One('product.product', 'Product', required=True,
|
||||||
|
domain=[
|
||||||
|
('type', '=', 'goods'),
|
||||||
|
- ('consumable', '=', False),
|
||||||
|
])
|
||||||
|
uom = fields.Function(fields.Many2One('product.uom', 'UOM'), 'get_uom')
|
||||||
|
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
Loading…
Reference in New Issue