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
1=== modified file 'mrp/mrp.py'
2--- mrp/mrp.py 2012-10-05 10:44:47 +0000
3+++ mrp/mrp.py 2013-04-02 08:51:31 +0000
4@@ -965,8 +965,11 @@
5 'state': 'waiting',
6 'company_id': production.company_id.id,
7 }
8- move_id = stock_move.create(cr, uid, data, context=context)
9- production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)
10+ if not production.move_created_ids:
11+ move_id = stock_move.create(cr, uid, data, context=context)
12+ production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)
13+ else:
14+ move_id = {}
15 return move_id
16
17 def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None):
18@@ -979,21 +982,24 @@
19 destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id
20 if not source_location_id:
21 source_location_id = production.location_src_id.id
22- move_id = stock_move.create(cr, uid, {
23- 'name': move_name,
24- 'date': production.date_planned,
25- 'product_id': production_line.product_id.id,
26- 'product_qty': production_line.product_qty,
27- 'product_uom': production_line.product_uom.id,
28- 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
29- 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
30- 'location_id': source_location_id,
31- 'location_dest_id': destination_location_id,
32- 'move_dest_id': parent_move_id,
33- 'state': 'waiting',
34- 'company_id': production.company_id.id,
35- })
36- production.write({'move_lines': [(4, move_id)]}, context=context)
37+ if not production.move_lines:
38+ move_id = stock_move.create(cr, uid, {
39+ 'name': move_name,
40+ 'date': production.date_planned,
41+ 'product_id': production_line.product_id.id,
42+ 'product_qty': production_line.product_qty,
43+ 'product_uom': production_line.product_uom.id,
44+ 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
45+ 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
46+ 'location_id': source_location_id,
47+ 'location_dest_id': destination_location_id,
48+ 'move_dest_id': parent_move_id,
49+ 'state': 'waiting',
50+ 'company_id': production.company_id.id,
51+ })
52+ production.write({'move_lines': [(4, move_id)]}, context=context)
53+ else:
54+ move_id = {}
55 return move_id
56
57 def action_confirm(self, cr, uid, ids, context=None):