diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py index a51a95c5d16..2ac983e67e4 100644 --- a/addons/project_mrp/__openerp__.py +++ b/addons/project_mrp/__openerp__.py @@ -51,6 +51,7 @@ automatically created via sale orders. 'init_xml': [], 'update_xml': ['project_mrp_workflow.xml', #'process/project_mrp_process.xml', + 'project_mrp_view.xml' ], 'demo_xml': [], 'test': ['test/project_task_procurement.yml'], diff --git a/addons/project_mrp/mrp.py b/addons/project_mrp/mrp.py index dc5d52e241d..b8eff3c8fa8 100644 --- a/addons/project_mrp/mrp.py +++ b/addons/project_mrp/mrp.py @@ -26,12 +26,16 @@ import tools class procurement_order(osv.osv): _name = "procurement.order" _inherit = "procurement.order" + _columns = { + 'task_id': fields.many2one('project.task', 'Task') + } def action_produce_assign_service(self, cr, uid, ids, context=None): if context is None: context = {} for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') + product_obj=self.pool.get('product.product') content = '' sale_order = self.pool.get('sale.order') so_ref = procurement.name.split(':')[0] @@ -69,6 +73,7 @@ class procurement_order(osv.osv): self.write(cr, uid, [procurement.id], {'state': 'running'}) name_task = ('','') + planned_hours=0.0 if procurement.product_id.type == 'service': proc_name = procurement.name if procurement.origin == proc_name: @@ -77,12 +82,12 @@ class procurement_order(osv.osv): name_task = (procurement.origin, proc_name or '') else: name_task = (procurement.product_id.name or procurement.origin, procurement.name or '') - + planned_hours= procurement.product_id.sale_delay +procurement.product_id. produce_delay task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' % name_task, 'date_deadline': procurement.date_planned, - 'planned_hours': procurement.product_qty, - 'remaining_hours': procurement.product_qty, + 'planned_hours':planned_hours, + 'remaining_hours': planned_hours, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, @@ -93,7 +98,8 @@ class procurement_order(osv.osv): 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) - + self.write(cr, uid, [procurement.id],{'task_id':task_id}) + product_obj.write(cr,uid,[procurement.product_id.id],{'user_id':uid,'project_id':project_id}) return task_id procurement_order() diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py index 09820d44c71..d946e2c2fd6 100644 --- a/addons/project_mrp/project_mrp.py +++ b/addons/project_mrp/project_mrp.py @@ -48,5 +48,13 @@ class project_task(osv.osv): return True project_task() +class product_product(osv.osv): + _inherit = "product.product" + _columns = { + 'user_id': fields.many2one('res.users', 'Responsible', ondelete='set null',help='Project Manager'), + 'project_id': fields.many2one('project.project', 'Project', ondelete='set null',) + } +product_product() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml new file mode 100644 index 00000000000..5d0c1d71381 --- /dev/null +++ b/addons/project_mrp/project_mrp_view.xml @@ -0,0 +1,31 @@ + + + + + procurement.procurement.form.view.inherit + procurement.order + form + + + + + + + + + + product.form.view.inherit + product.product + form + + + + + + + + + + + + \ No newline at end of file