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

Proposed by Yann Papouin
Status: Merged
Merged at revision: 6838
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-997642-fix-services-make-to-stock
Merge into: lp:ocb-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/ocb-addons/6.1-bug-997642-fix-services-make-to-stock
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests Approve
Holger Brunn (Therp) code review Approve
Review via email: mp+203903@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

#19 should this be p.product_id.procure_method?

review: Needs Fixing (code review)
Revision history for this message
Yann Papouin (yann-papouin) wrote :

No, the procure_method is stored in the procurement object when created.
https://bugs.launchpad.net/ocb-addons/+bug/997642/comments/7

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Thanks for your pointer and sorry for overlooking!

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)

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 2014-01-30 10:05:07 +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()

Subscribers

People subscribed via source and target branches