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.

Unmerged revisions

7246. By Yann Papouin

[FIX]Services with "Make to stock" procure_method stay in "Running" state

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project_mrp/project_procurement.py'
2--- project_mrp/project_procurement.py 2011-12-19 16:54:40 +0000
3+++ project_mrp/project_procurement.py 2013-09-11 08:32:52 +0000
4@@ -20,6 +20,7 @@
5 ##############################################################################
6
7 from osv import fields, osv
8+from openerp.tools.translate import _
9
10 class procurement_order(osv.osv):
11 _name = "procurement.order"
12@@ -37,8 +38,10 @@
13 """ Checks if task is done or not.
14 @return: True or False.
15 """
16- return all(proc.product_id.type != 'service' or (proc.task_id and proc.task_id.state in ('done', 'cancelled')) \
17- for proc in self.browse(cr, uid, ids, context=context))
18+ for p in self.browse(cr, uid, ids, context=context):
19+ 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')):
20+ return False
21+ return True
22
23 def check_produce_service(self, cr, uid, procurement, context=None):
24 return True
25@@ -80,7 +83,7 @@
26 'project_id': project and project.id or False,
27 'company_id': procurement.company_id.id,
28 },context=context)
29- self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running'}, context=context)
30+ self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':_('Task created.')}, context=context)
31 return task_id
32
33 procurement_order()