From 7226e699bb0e85b088d1e487da9c44b633fc3cbb Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 20 Dec 2013 11:57:22 +0100 Subject: [PATCH] [FIX] project_mrp: removal of picked_rate as it was also removed in sale_stock module by fp's big refactoring of revision 8844. Seems like this is deprecated and useless bzr revid: qdp-launchpad@openerp.com-20131220105722-qo110vpk626ge7zh --- addons/project_mrp/project_mrp.py | 48 ------------------------------- 1 file changed, 48 deletions(-) diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py index eef0163dde0..c0df0a82519 100644 --- a/addons/project_mrp/project_mrp.py +++ b/addons/project_mrp/project_mrp.py @@ -158,52 +158,4 @@ class sale_order_line(osv.osv): return True return super(sale_order_line, self).need_procurement(cr, uid, ids, context=context) -class sale_order(osv.osv): - _inherit = 'sale.order' - - def _picked_rate(self, cr, uid, ids, name, arg, context=None): - if not ids: - return {} - res_sale = {} - res = super(sale_order, self)._picked_rate(cr, uid, ids, name, arg, context=context) - cr.execute('''select sol.order_id as sale_id, stage.closed as task_closed , - t.id as task_id, sum(sol.product_uom_qty) as total - from project_task as t - left join sale_order_line as sol on sol.id = t.sale_line_id - left join project_task_type as stage on stage.id = t.stage_id - where sol.order_id in %s group by sol.order_id,stage.closed,t.id ''',(tuple(ids),)) - sale_task_data = cr.dictfetchall() - - if not sale_task_data: - return res - - for id in ids: - res_sale[id] = { - 'number_of_done': 0, - 'total_no_task': 0, - } - #compute the sum of quantity for each SO - cr.execute('''select sol.order_id as sale_id, sum(sol.product_uom_qty) as total - from sale_order_line sol where sol.order_id in %s group by sol.order_id''',(tuple(ids),)) - total_qtty_ref = cr.dictfetchall() - for item in total_qtty_ref: - res_sale[item['sale_id']]['number_of_stockable'] = item['total'] - - for item in sale_task_data: - res_sale[item['sale_id']]['total_no_task'] += item['total'] - if item['task_closed']: - res_sale[item['sale_id']]['number_of_done'] += item['total'] - - for sale in self.browse(cr, uid, ids, context=context): - if 'number_of_stockable' in res_sale[sale.id]: - res_sale[sale.id]['number_of_stockable'] -= res_sale[sale.id]['total_no_task'] - #adjust previously percentage because now we must also count the product of type service - res[sale.id] = res[sale.id] * float(res_sale[sale.id]['number_of_stockable']) / (res_sale[sale.id]['number_of_stockable'] + res_sale[sale.id]['total_no_task']) - #add the task - res[sale.id] += res_sale[sale.id]['number_of_done'] * 100 / (res_sale[sale.id]['number_of_stockable'] + res_sale[sale.id]['total_no_task']) - return res - - _columns = { - 'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'), - }