Merge lp:~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date into lp:ocb-addons/6.1

Proposed by Yann Papouin
Status: Merged
Approved by: Holger Brunn (Therp)
Approved revision: no longer in the source branch.
Merged at revision: 6834
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date
Merge into: lp:ocb-addons/6.1
Diff against target: 24 lines (+5/-2)
1 file modified
mrp/mrp.py (+5/-2)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Stefan Rijnhart (Opener) Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+205174@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Same as official. LGTM.

Regards.

review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks! Like Pedro said, equivalent to the change merged in 7.0: http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/revision/9477.

Only difference is explicitely passing on the order by 'sequence'. Just curiosity, isn't this already the default order?

review: Approve
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp/mrp.py'
2--- mrp/mrp.py 2012-10-05 10:44:47 +0000
3+++ mrp/mrp.py 2014-02-06 14:46:08 +0000
4@@ -23,6 +23,7 @@
5 from osv import osv, fields
6 import decimal_precision as dp
7 from tools import float_compare
8+from tools import DEFAULT_SERVER_DATETIME_FORMAT
9 from tools.translate import _
10 import netsvc
11 import time
12@@ -280,8 +281,10 @@
13 @param properties: List of related properties.
14 @return: False or BoM id.
15 """
16- cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
17- ids = map(lambda x: x[0], cr.fetchall())
18+ domain = [('product_id', '=', product_id), ('bom_id', '=', False),
19+ '|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
20+ '|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))]
21+ ids = self.search(cr, uid, domain, order='sequence')
22 max_prop = 0
23 result = False
24 for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):

Subscribers

People subscribed via source and target branches