Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-925351-mma into
lp:openobject-addons.
Requested reviews:
Mayur Maheshwari(OpenERP) (mma-openerp)
qdp (OpenERP) (qdp)
Rucha (Open ERP) (rpa-openerp)
Raphael Collet (OpenERP) (rco-openerp)
Related bugs:
Bug #925351 in OpenERP Addons: "6.1.0 RC1 mrp MO wrong destination location
for finished product"
https://bugs.launchpad.net/openobject-addons/+bug/925351
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-925351-mma/+merge/91642
Hello,
stock : set a destination location for move
Thanks.
mma
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-925351-mma/+merge/91642
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-925351-mma.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2012-02-13 18:07:41 +0000
+++ mrp/mrp.py 2012-02-15 10:06:19 +0000
@@ -736,7 +736,7 @@
# we already have more qtys consumed than we need
continue
- raw_product[0].action_consume(qty, raw_product[0].location_id.id, context=context)
+ raw_product[0].action_consume(qty, raw_product[0].location_id.id, raw_product[0].location_dest_id.id, context=context)
if production_mode == 'consume_produce':
# To produce remaining qty of final product
=== modified file 'mrp/stock.py'
--- mrp/stock.py 2012-01-31 13:36:57 +0000
+++ mrp/stock.py 2012-02-15 10:06:19 +0000
@@ -102,7 +102,7 @@
wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
return processed_ids
- def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
+ def action_consume(self, cr, uid, ids, product_qty, location_id=False, location_dest_id=False, context=None):
""" Consumed product with specific quatity from specific source location.
@param product_qty: Consumed product quantity
@param location_id: Source location
@@ -113,7 +113,7 @@
wf_service = netsvc.LocalService("workflow")
for move in self.browse(cr, uid, ids):
move.action_confirm(context)
- new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
+ new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, location_dest_id, context=context)
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
for prod in production_obj.browse(cr, uid, production_ids, context=context):
if prod.state == 'confirmed':
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-02-14 18:43:31 +0000
+++ stock/stock.py 2012-02-15 10:06:19 +0000
@@ -2423,7 +2423,7 @@
self.write(cr, uid, [current_move], update_val)
return res
- def action_consume(self, cr, uid, ids, quantity, location_id=False, context=None):
+ def action_consume(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, context=None):
""" Consumed product with specific quatity from specific source location
@param cr: the database cursor
@param uid: the user id
@@ -2452,14 +2452,13 @@
quantity = move.product_qty
uos_qty = quantity / move_qty * move.product_uos_qty
- location_dest_id = move.product_id.property_stock_production or move.location_dest_id
if quantity_rest > 0:
default_val = {
'product_qty': quantity,
'product_uos_qty': uos_qty,
'state': move.state,
'location_id': location_id or move.location_id.id,
- 'location_dest_id': location_dest_id.id,
+ 'location_dest_id': location_dest_id or move.location_dest_id.id,
}
current_move = self.copy(cr, uid, move.id, default_val)
res += [current_move]
@@ -2476,7 +2475,7 @@
'product_qty' : quantity_rest,
'product_uos_qty' : uos_qty_rest,
'location_id': location_id or move.location_id.id,
- 'location_dest_id': location_dest_id.id,
+ 'location_dest_id': location_dest_id or move.location_dest_id.id,
}
self.write(cr, uid, [move.id], update_val)
=== modified file 'stock/test/shipment.yml'
--- stock/test/shipment.yml 2012-01-31 13:36:57 +0000
+++ stock/test/shipment.yml 2012-02-15 10:06:19 +0000
@@ -189,19 +189,17 @@
!python {model: stock.location}: |
ctx = {'product_id': ref('product_icecream')}
refrigerator_location = self.browse(cr, uid, ref('location_refrigerator'), context=ctx)
- assert refrigerator_location.stock_real == 131.96, 'stock does not correspond in refrigerator location.'
+ assert refrigerator_location.stock_real == 135.96, 'stock does not correspond in refrigerator location.'
scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx)
assert scrapped_location.stock_real == 0.010*4, 'scraped stock does not correspond in scrap location.'
- production_location = self.browse(cr, uid, ref('location_production'), context=ctx)
- assert production_location.stock_real == 1*4, 'consume stock does not correspond in production location.' #TOFIX: consume stock is not updated in default production location of product.
-
I check availabile stock after consumed and scraped.
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_icecream'), context=context)
- assert product.qty_available == 131.96, "Stock does not correspond."
- assert round(product.virtual_available, 2) == 1.96, "Vitual stock does not correspond."
+ assert product.qty_available == 135.96, "Stock does not correspond."
+ assert round(product.virtual_available, 2) == 5.96, "Vitual stock does not correspond."
-
I trace all incoming lots.
-
@@ -276,5 +274,5 @@
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_icecream'), context=context)
- assert round(product.qty_available, 2) == 1.96, "Stock does not correspond."
- assert round(product.virtual_available, 2) == 1.96, "Vitual stock does not correspond."
+ assert round(product.qty_available, 2) == 5.96, "Stock does not correspond."
+ assert round(product.virtual_available, 2) == 5.96, "Vitual stock does not correspond."
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp