[MERGE] fix procurement MTO service

bzr revid: fp@tinyerp.com-20120930105900-7grdgw3jbr0stlmc
This commit is contained in:
Fabien Pinckaers 2012-09-30 12:59:00 +02:00
commit 181eda0d2b
1 changed files with 5 additions and 3 deletions

View File

@ -37,8 +37,10 @@ class procurement_order(osv.osv):
""" Checks if task is done or not.
@return: True or False.
"""
return all(proc.product_id.type != 'service' or (proc.task_id and proc.task_id.state in ('done', 'cancelled')) \
for proc in self.browse(cr, uid, ids, context=context))
for p in self.browse(cr, uid, ids, context=context):
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')):
return False
return True
def check_produce_service(self, cr, uid, procurement, context=None):
return True
@ -81,7 +83,7 @@ class procurement_order(osv.osv):
'project_id': project and project.id or False,
'company_id': procurement.company_id.id,
},context=context)
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running'}, context=context)
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context)
self.running_send_note(cr, uid, ids, context=None)
return task_id