From cac6a261fe3e0365a34ba8268f7075be82f224de Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 26 Sep 2014 16:05:16 +0200 Subject: [PATCH] [FIX] project_mrp: task description duplicated + product name translation --- addons/project_mrp/project_procurement.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 25e88da298a..ad6dd667523 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -67,19 +67,27 @@ class procurement_order(osv.osv): return project def action_produce_assign_service(self, cr, uid, ids, context=None): + if not context: + context = {} project_task = self.pool.get('project.task') for procurement in self.browse(cr, uid, ids, context=context): project = self._get_project(cr, uid, procurement, context=context) planned_hours = self._convert_qty_company_hours(cr, uid, procurement, context=context) + manager = procurement.product_id.product_manager + partner = procurement.sale_line_id and procurement.sale_line_id.order_id.partner_id or None + lang = (manager and manager.lang) or (partner and partner.lang) or False + if not lang: + lang = self.pool['res.users'].browse(cr, uid, uid, context=context).lang + product = self.pool['product.product'].browse(cr, uid, procurement.product_id.id, context=dict(context, lang=lang)) task_id = project_task.create(cr, uid, { - 'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name), + 'name': '%s:%s' % (procurement.origin or '', product.name), 'date_deadline': procurement.date_planned, 'planned_hours': planned_hours, 'remaining_hours': planned_hours, 'partner_id': procurement.sale_line_id and procurement.sale_line_id.order_id.partner_id.id or False, 'user_id': procurement.product_id.product_manager.id, 'procurement_id': procurement.id, - 'description': procurement.name + '\n' + (procurement.note or ''), + 'description': procurement.sale_line_id and procurement.sale_line_id.name or procurement.name, 'project_id': project and project.id or False, 'company_id': procurement.company_id.id, },context=context)