Merge lp:~openerp-dev/openobject-addons/6.1-opw-584402-han into lp:openobject-addons/6.1

Proposed by Hardik Ansodariya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-584402-han
Merge into: lp:openobject-addons/6.1
Diff against target: 57 lines (+23/-17)
1 file modified
mrp/mrp.py (+23/-17)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-584402-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+156492@code.launchpad.net

Description of the change

Hello,

I have fixed the issue of duplicating move "Product to Consumed" when related picking list of MO is cancelled and recreated again.

Steps.

Create a MO with say product A(BOM: with component product B), Confirm Production, move will be created in Product to consume.

Also related internal picking will be created for the component, cancel this picking, Reload MO, 'Recreated Picking' button will be enable to recreate the picking when click on this button "Product to Consumed" is duplicated.

Kindly review it and share your thoughts on this.

To post a comment you must log in.

Unmerged revisions

7170. By Hardik Ansodariya (OpenERP)

[FIXED] mrp: Fixed the issue of duplicating product to consume, if related picking list is canceled and recreated from MO

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2012-10-05 10:44:47 +0000
+++ mrp/mrp.py 2013-04-02 08:51:31 +0000
@@ -965,8 +965,11 @@
965 'state': 'waiting',965 'state': 'waiting',
966 'company_id': production.company_id.id,966 'company_id': production.company_id.id,
967 }967 }
968 move_id = stock_move.create(cr, uid, data, context=context)968 if not production.move_created_ids:
969 production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)969 move_id = stock_move.create(cr, uid, data, context=context)
970 production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)
971 else:
972 move_id = {}
970 return move_id973 return move_id
971974
972 def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None):975 def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None):
@@ -979,21 +982,24 @@
979 destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id982 destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id
980 if not source_location_id:983 if not source_location_id:
981 source_location_id = production.location_src_id.id984 source_location_id = production.location_src_id.id
982 move_id = stock_move.create(cr, uid, {985 if not production.move_lines:
983 'name': move_name,986 move_id = stock_move.create(cr, uid, {
984 'date': production.date_planned,987 'name': move_name,
985 'product_id': production_line.product_id.id,988 'date': production.date_planned,
986 'product_qty': production_line.product_qty,989 'product_id': production_line.product_id.id,
987 'product_uom': production_line.product_uom.id,990 'product_qty': production_line.product_qty,
988 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,991 'product_uom': production_line.product_uom.id,
989 'product_uos': production_line.product_uos and production_line.product_uos.id or False,992 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
990 'location_id': source_location_id,993 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
991 'location_dest_id': destination_location_id,994 'location_id': source_location_id,
992 'move_dest_id': parent_move_id,995 'location_dest_id': destination_location_id,
993 'state': 'waiting',996 'move_dest_id': parent_move_id,
994 'company_id': production.company_id.id,997 'state': 'waiting',
995 })998 'company_id': production.company_id.id,
996 production.write({'move_lines': [(4, move_id)]}, context=context)999 })
1000 production.write({'move_lines': [(4, move_id)]}, context=context)
1001 else:
1002 move_id = {}
997 return move_id1003 return move_id
9981004
999 def action_confirm(self, cr, uid, ids, context=None):1005 def action_confirm(self, cr, uid, ids, context=None):