Merge lp:~openerp-dev/openobject-addons/6.0-opw-572530-rha into lp:openobject-addons/6.0

Proposed by Rifakat Husen (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-572530-rha
Merge into: lp:openobject-addons/6.0
Diff against target: 57 lines (+23/-3)
3 files modified
mrp/procurement.py (+16/-0)
product/product.py (+4/-1)
purchase/purchase.py (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-572530-rha
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+97395@code.launchpad.net

Description of the change

Hello,

Procurements from manufacturing order does not round up product qty on purchase order.
Make sure that raw material should always round up and production gets sufficient product qty.

Please review it and let me know if changes required.
Thanks,
Rifakat

To post a comment you must log in.

Unmerged revisions

5136. By Rifakat Husen (OpenERP)

[FIX] mrp, purchase: make sure that arw material shoul always round up and production gets sufficient product

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp/procurement.py'
2--- mrp/procurement.py 2011-01-14 00:11:01 +0000
3+++ mrp/procurement.py 2012-03-14 13:13:26 +0000
4@@ -107,6 +107,22 @@
5 {'location_id': procurement.location_id.id})
6 return res
7
8+ def make_po(self, cr, uid, ids, context=None):
9+ """
10+ This method will make sure that Manufacturing(production) gets
11+ sufficient quantity from purchase.
12+ """
13+ if not context:
14+ context = {}
15+ production_obj = self.pool.get('mrp.production')
16+ for procurement in self.browse(cr, uid, ids, context=context):
17+ if procurement.move_id and procurement.move_id.picking_id:
18+ production_ids = production_obj.search(cr, uid, [('picking_id','=',procurement.move_id.picking_id.id)], context=context)
19+ if production_ids:
20+ context.update({'bom':True})
21+ return super(procurement_order,self).make_po(cr, uid, ids, context=context)
22+
23+
24 procurement_order()
25
26 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
27
28=== modified file 'product/product.py'
29--- product/product.py 2012-01-04 09:41:31 +0000
30+++ product/product.py 2012-03-14 13:13:26 +0000
31@@ -144,7 +144,10 @@
32 return qty
33 amount = qty / from_unit.factor
34 if to_unit:
35- amount = rounding(amount * to_unit.factor, to_unit.rounding)
36+ if context.get('bom'):
37+ amount = math.ceil(amount * to_unit.factor)
38+ else:
39+ amount = rounding(amount * to_unit.factor, to_unit.rounding)
40 return amount
41
42 def _compute_price(self, cr, uid, from_uom_id, price, to_uom_id=False):
43
44=== modified file 'purchase/purchase.py'
45--- purchase/purchase.py 2012-03-12 12:03:28 +0000
46+++ purchase/purchase.py 2012-03-14 13:13:26 +0000
47@@ -807,8 +807,9 @@
48 fiscal_position = partner.property_account_position and partner.property_account_position.id or False
49
50 uom_id = procurement.product_id.uom_po_id.id
51-
52- qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
53+ qty = uom_obj._compute_qty_obj(cr, uid, procurement.product_uom,
54+ procurement.product_qty, procurement.product_id.uom_po_id,
55+ context=context)
56 if seller_qty:
57 qty = max(qty,seller_qty)
58