← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/6.1-bug-997642-fix-services-make-to-stock into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #997642 in OpenERP Community Backports (Addons): "[Trunk/6.1] Services with "Make to stock" procure_method stay in "Running" state"
  https://bugs.launchpad.net/ocb-addons/+bug/997642

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-997642-fix-services-make-to-stock/+merge/203903

Automatically derived from https://code.launchpad.net/~yann-papouin/openobject-addons/6.1-bug-997642-fix-services-make-to-stock for https://code.launchpad.net/~openerp/openobject-addons/6.1.
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-997642-fix-services-make-to-stock/+merge/203903
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/6.1-bug-997642-fix-services-make-to-stock into lp:ocb-addons/6.1.
=== modified file 'project_mrp/project_procurement.py'
--- project_mrp/project_procurement.py	2011-12-19 16:54:40 +0000
+++ project_mrp/project_procurement.py	2014-01-30 10:05:07 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv
+from openerp.tools.translate import _
 
 class procurement_order(osv.osv):
     _name = "procurement.order"
@@ -37,8 +38,10 @@
         """ 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
@@ -80,7 +83,7 @@
                 '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':_('Task created.')}, context=context)
         return task_id
 
 procurement_order()


Follow ups