Hardik Ansodariya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-575908-han into
lp:openobject-addons/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-575908-han/+merge/110804
Hello,
I have backport the code from
lp:~openerp-dev/openobject-addons/6.1-opw-574049-rgo into
lp:openobject-addons/6.1 in 6.0
With reference of Maintenance case: 575908
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-575908-han/+merge/110804
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-575908-han.
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-04-24 13:28:19 +0000
+++ sale/sale.py 2012-06-18 12:46:27 +0000
@@ -810,6 +810,32 @@
return False
sale_order()
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
+
+ def _quantity_compute_get(self, cr, uid, proc, context=None):
+ """ Computes only quantity of product that were Delivered and also computes the quantity of returned products.
+ @param proc: Current procurement.
+ @return: Quantity or False.
+ """
+ if proc.product_id.type == 'product' and proc.move_id:
+ move_obj = self.pool.get('stock.move')
+ sale_id = proc.move_id.picking_id.sale_id.id
+ picking_ids = self.pool.get('stock.picking').search(cr, uid, [('sale_id', '=', sale_id), ('state', '=', 'done'), ('type', '=', 'out')], context=context)
+ returned_picking_ids = self.pool.get('stock.picking').search(cr, uid, [('sale_id', '=', sale_id), ('state', '=', 'done'), ('type', '=', 'in')], context=context)
+ qty_uos = 0
+ for returned_picking_id in returned_picking_ids:
+ move_ids = move_obj.search(cr, uid, [('picking_id', '=', returned_picking_id)], context=context)
+ qty_uos = move_obj.browse(cr, uid, move_ids, context=context)[0].product_uos_qty
+ qty_uos = -qty_uos
+ for picking_id in picking_ids:
+ move_ids = move_obj.search(cr, uid, [('picking_id', '=', picking_id)], context=context)
+ qty_uos = move_obj.browse(cr, uid, move_ids, context=context)[0].product_uos_qty
+ return qty_uos
+ return False
+
+procurement_order()
+
# TODO add a field price_unit_uos
# - update it on change product and unit price
# - use it in report if there is a uos
_______________________________________________
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