Merge lp:~openerp-commiter/openobject-addons/5.0-bug-723641-dhs into lp:openobject-addons/5.0

Proposed by Dhruti Shastri(OpenERP)
Status: Merged
Approved by: Jay Vora (Serpent Consulting Services)
Approved revision: no longer in the source branch.
Merged at revision: 2912
Proposed branch: lp:~openerp-commiter/openobject-addons/5.0-bug-723641-dhs
Merge into: lp:openobject-addons/5.0
Diff against target: 80 lines (+11/-9)
1 file modified
mrp/mrp.py (+11/-9)
To merge this branch: bzr merge lp:~openerp-commiter/openobject-addons/5.0-bug-723641-dhs
Reviewer Review Type Date Requested Status
Jay Vora (Serpent Consulting Services) (community) Approve
Review via email: mp+51287@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) :
review: Approve

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 2011-02-21 07:22:04 +0000
3+++ mrp/mrp.py 2011-02-25 12:39:16 +0000
4@@ -815,8 +815,8 @@
5 phantom_bom_id = self.pool.get('mrp.bom').search(cr, uid, [
6 ('product_id', '=', procurement.move_id.product_id.id),
7 ('bom_id', '=', False),
8- ('type', '=', 'phantom')])
9- return phantom_bom_id
10+ ('type', '=', 'phantom')])
11+ return phantom_bom_id
12 return False
13
14 def check_move_cancel(self, cr, uid, ids, context={}):
15@@ -994,7 +994,7 @@
16 produce_id = False
17 company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
18 for procurement in self.browse(cr, uid, ids):
19- res_id = procurement.move_id.id
20+ res_id = procurement.move_id.id or False
21 loc_id = procurement.location_id.id
22 newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - DateTime.RelativeDateTime(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0)
23 newdate = newdate - DateTime.RelativeDateTime(days=company.manufacturing_lead)
24@@ -1011,12 +1011,14 @@
25 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
26 'move_prod_id': res_id,
27 })
28+
29 self.write(cr, uid, [procurement.id], {'state':'running'})
30 bom_result = self.pool.get('mrp.production').action_compute(cr, uid,
31 [produce_id], properties=[x.id for x in procurement.property_ids])
32 wf_service = netsvc.LocalService("workflow")
33 wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
34- self.pool.get('stock.move').write(cr, uid, [res_id],
35+ if res_id:
36+ self.pool.get('stock.move').write(cr, uid, [res_id],
37 {'location_id':procurement.location_id.id})
38 return produce_id
39
40@@ -1024,7 +1026,7 @@
41 purchase_id = False
42 company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
43 for procurement in self.browse(cr, uid, ids):
44- res_id = procurement.move_id.id
45+ res_id = procurement.move_id.id or False
46 partner = procurement.product_id.seller_ids[0].name
47 partner_id = partner.id
48 address_id = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['delivery'])['delivery']
49@@ -1035,7 +1037,7 @@
50 qty = self.pool.get('product.uom')._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
51 if procurement.product_id.seller_ids[0].qty:
52 qty=max(qty,procurement.product_id.seller_ids[0].qty)
53-
54+
55 price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id]
56
57 newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S')
58@@ -1044,7 +1046,7 @@
59
60 #Passing partner_id to context for purchase order line integrity of Line name
61 context.update({'lang':partner.lang, 'partner_id':partner_id})
62-
63+
64 product=self.pool.get('product.product').browse(cr,uid,procurement.product_id.id,context=context)
65
66 line = {
67@@ -1161,11 +1163,11 @@
68 'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
69 'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
70 }
71-
72+
73 _sql_constraints = [
74 ( 'qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
75 ]
76-
77+
78 def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
79 if warehouse_id:
80 w=self.pool.get('stock.warehouse').browse(cr,uid,warehouse_id, context)