Mayur Maheshwari(OpenErp) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-794431-mma into 
lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #794431 in OpenERP Addons: "sub_product results in wrong resulted 
quantity "
  https://bugs.launchpad.net/openobject-addons/+bug/794431

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-794431-mma/+merge/64536
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-794431-mma/+merge/64536
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-794431-mma.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2011-05-06 10:36:39 +0000
+++ mrp/mrp.py	2011-06-14 11:54:34 +0000
@@ -749,11 +749,14 @@
 
             for produce_product in production.move_created_ids:
                 produced_qty = produced_products.get(produce_product.product_id.id, 0)
-                rest_qty = production.product_qty - produced_qty
+                partial_qty = production.product_qty - produced_qty 
+                if partial_qty <= 0:
+                    partial_qty = production_qty
+                rest_qty = production_qty*produce_product.product_qty/partial_qty
                 if rest_qty <= production_qty:
                     production_qty = rest_qty
                 if rest_qty > 0 :
-                    stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, context=context)
+                    stock_mov_obj.action_consume(cr, uid, [produce_product.id], rest_qty, context=context)
 
         for raw_product in production.move_lines2:
             new_parent_ids = []

=== modified file 'mrp/wizard/mrp_product_produce.py'
--- mrp/wizard/mrp_product_produce.py	2011-04-21 05:14:24 +0000
+++ mrp/wizard/mrp_product_produce.py	2011-06-14 11:54:34 +0000
@@ -49,8 +49,9 @@
                                 context['active_id'], context=context)
         done = 0.0
         for move in prod.move_created_ids2:
-            if not move.scrapped:
-                done += move.product_qty
+            if move.product_id == prod.product_id:
+                if not move.scrapped:
+                    done += move.product_qty
         return (prod.product_qty - done) or prod.product_qty
 
     _defaults = {

_______________________________________________
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

Reply via email to