Merge lp:~yann-papouin/openobject-addons/6.1-bug-997642-fix-services-make-to-stock into lp:openobject-addons/6.1

Proposed by Yann Papouin
Status: Needs review
Proposed branch: lp:~yann-papouin/openobject-addons/6.1-bug-997642-fix-services-make-to-stock
Merge into: lp:openobject-addons/6.1
Diff against target: 33 lines (+6/-3)
1 file modified
project_mrp/project_procurement.py (+6/-3)
To merge this branch: bzr merge lp:~yann-papouin/openobject-addons/6.1-bug-997642-fix-services-make-to-stock
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+184957@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'project_mrp/project_procurement.py'
--- project_mrp/project_procurement.py 2011-12-19 16:54:40 +0000
+++ project_mrp/project_procurement.py 2013-09-11 08:32:52 +0000
@@ -20,6 +20,7 @@
20##############################################################################20##############################################################################
2121
22from osv import fields, osv22from osv import fields, osv
23from openerp.tools.translate import _
2324
24class procurement_order(osv.osv):25class procurement_order(osv.osv):
25 _name = "procurement.order"26 _name = "procurement.order"
@@ -37,8 +38,10 @@
37 """ Checks if task is done or not.38 """ Checks if task is done or not.
38 @return: True or False.39 @return: True or False.
39 """40 """
40 return all(proc.product_id.type != 'service' or (proc.task_id and proc.task_id.state in ('done', 'cancelled')) \41 for p in self.browse(cr, uid, ids, context=context):
41 for proc in self.browse(cr, uid, ids, context=context))42 if (p.product_id.type=='service') and (p.procure_method=='make_to_order') and p.task_id and (p.task_id.state not in ('done', 'cancelled')):
43 return False
44 return True
4245
43 def check_produce_service(self, cr, uid, procurement, context=None): 46 def check_produce_service(self, cr, uid, procurement, context=None):
44 return True47 return True
@@ -80,7 +83,7 @@
80 'project_id': project and project.id or False,83 'project_id': project and project.id or False,
81 'company_id': procurement.company_id.id,84 'company_id': procurement.company_id.id,
82 },context=context)85 },context=context)
83 self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running'}, context=context)86 self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':_('Task created.')}, context=context)
84 return task_id87 return task_id
8588
86procurement_order()89procurement_order()