← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1049415 in OpenERP Community Backports (Addons): "the BoM does not validate field active nor dates"
  https://bugs.launchpad.net/ocb-addons/+bug/1049415

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date/+merge/205174
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date/+merge/205174
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/6.1-bug-1049415-bomfind-active-date into lp:ocb-addons/6.1.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2012-10-05 10:44:47 +0000
+++ mrp/mrp.py	2014-02-06 14:46:08 +0000
@@ -23,6 +23,7 @@
 from osv import osv, fields
 import decimal_precision as dp
 from tools import float_compare
+from tools import DEFAULT_SERVER_DATETIME_FORMAT
 from tools.translate import _
 import netsvc
 import time
@@ -280,8 +281,10 @@
         @param properties: List of related properties.
         @return: False or BoM id.
         """
-        cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
-        ids = map(lambda x: x[0], cr.fetchall())
+        domain = [('product_id', '=', product_id), ('bom_id', '=', False),
+                  '|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
+                  '|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))]
+        ids = self.search(cr, uid, domain, order='sequence')
         max_prop = 0
         result = False
         for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):


Follow ups