Merge lp:~openerp-dev/openobject-addons/6.0-opw-575908-han into lp:openobject-addons/6.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-575908-han
Merge into: lp:openobject-addons/6.0
Diff against target: 36 lines (+26/-0)
1 file modified
sale/sale.py (+26/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-575908-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+110804@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

5235. By Hardik Ansodariya (OpenERP)

[FIX] sale: Backport from the lp:~openerp-dev/openobject-addons/6.1-opw-574049-rgo into lp:openobject-addons/6.1 (Maintanence Case:575908)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2012-04-24 13:28:19 +0000
3+++ sale/sale.py 2012-06-18 12:46:27 +0000
4@@ -810,6 +810,32 @@
5 return False
6 sale_order()
7
8+class procurement_order(osv.osv):
9+ _inherit = 'procurement.order'
10+
11+ def _quantity_compute_get(self, cr, uid, proc, context=None):
12+ """ Computes only quantity of product that were Delivered and also computes the quantity of returned products.
13+ @param proc: Current procurement.
14+ @return: Quantity or False.
15+ """
16+ if proc.product_id.type == 'product' and proc.move_id:
17+ move_obj = self.pool.get('stock.move')
18+ sale_id = proc.move_id.picking_id.sale_id.id
19+ picking_ids = self.pool.get('stock.picking').search(cr, uid, [('sale_id', '=', sale_id), ('state', '=', 'done'), ('type', '=', 'out')], context=context)
20+ returned_picking_ids = self.pool.get('stock.picking').search(cr, uid, [('sale_id', '=', sale_id), ('state', '=', 'done'), ('type', '=', 'in')], context=context)
21+ qty_uos = 0
22+ for returned_picking_id in returned_picking_ids:
23+ move_ids = move_obj.search(cr, uid, [('picking_id', '=', returned_picking_id)], context=context)
24+ qty_uos = move_obj.browse(cr, uid, move_ids, context=context)[0].product_uos_qty
25+ qty_uos = -qty_uos
26+ for picking_id in picking_ids:
27+ move_ids = move_obj.search(cr, uid, [('picking_id', '=', picking_id)], context=context)
28+ qty_uos = move_obj.browse(cr, uid, move_ids, context=context)[0].product_uos_qty
29+ return qty_uos
30+ return False
31+
32+procurement_order()
33+
34 # TODO add a field price_unit_uos
35 # - update it on change product and unit price
36 # - use it in report if there is a uos