Rifakat (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-572530-rha into
lp:openobject-addons/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #718722 in OpenERP Addons: "[PS] Manufacturing : raw material units
should always be rounded up"
https://bugs.launchpad.net/openobject-addons/+bug/718722
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-572530-rha/+merge/97395
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
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-572530-rha/+merge/97395
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-572530-rha.
=== modified file 'mrp/procurement.py'
--- mrp/procurement.py 2011-01-14 00:11:01 +0000
+++ mrp/procurement.py 2012-03-14 13:13:26 +0000
@@ -107,6 +107,22 @@
{'location_id': procurement.location_id.id})
return res
+ def make_po(self, cr, uid, ids, context=None):
+ """
+ This method will make sure that Manufacturing(production) gets
+ sufficient quantity from purchase.
+ """
+ if not context:
+ context = {}
+ production_obj = self.pool.get('mrp.production')
+ for procurement in self.browse(cr, uid, ids, context=context):
+ if procurement.move_id and procurement.move_id.picking_id:
+ production_ids = production_obj.search(cr, uid, [('picking_id','=',procurement.move_id.picking_id.id)], context=context)
+ if production_ids:
+ context.update({'bom':True})
+ return super(procurement_order,self).make_po(cr, uid, ids, context=context)
+
+
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'product/product.py'
--- product/product.py 2012-01-04 09:41:31 +0000
+++ product/product.py 2012-03-14 13:13:26 +0000
@@ -144,7 +144,10 @@
return qty
amount = qty / from_unit.factor
if to_unit:
- amount = rounding(amount * to_unit.factor, to_unit.rounding)
+ if context.get('bom'):
+ amount = math.ceil(amount * to_unit.factor)
+ else:
+ amount = rounding(amount * to_unit.factor, to_unit.rounding)
return amount
def _compute_price(self, cr, uid, from_uom_id, price, to_uom_id=False):
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py 2012-03-12 12:03:28 +0000
+++ purchase/purchase.py 2012-03-14 13:13:26 +0000
@@ -807,8 +807,9 @@
fiscal_position = partner.property_account_position and partner.property_account_position.id or False
uom_id = procurement.product_id.uom_po_id.id
-
- qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
+ qty = uom_obj._compute_qty_obj(cr, uid, procurement.product_uom,
+ procurement.product_qty, procurement.product_id.uom_po_id,
+ context=context)
if seller_qty:
qty = max(qty,seller_qty)
_______________________________________________
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