Merge lp:~vauxoo/openobject-addons/addons-6.1-mrp_bug_bom-dev-julio into lp:openobject-addons/6.1

Proposed by Julio Serna-
Status: Needs review
Proposed branch: lp:~vauxoo/openobject-addons/addons-6.1-mrp_bug_bom-dev-julio
Merge into: lp:openobject-addons/6.1
Diff against target: 18 lines (+7/-1)
1 file modified
mrp/ (+7/-1)
To merge this branch: bzr merge lp:~vauxoo/openobject-addons/addons-6.1-mrp_bug_bom-dev-julio
Reviewer Review Type Date Requested Status
Chris Biersbach (OpenERP) Pending
Olivier Dony (Odoo) Pending
Moisés López - Pending
Review via email:

Description of the change

modifies query that gets the BoM, validating if the BoM is active or if the date is in valid range

To post a comment you must log in.
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Hi Julio,
Your fix works great.
You may also use search() instead,
domain = [('product_id', '=', product_id), ('bom_id', '=', False), '&',
           '|', ('date_start', '=', False), ('date_start', '<=', time.strftime('%Y-%m-%d %H:%M:%S')),
           '|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime('%Y-%m-%d %H:%M:%S'))]

How about this one?
I will fix using search() for 7.0.


Revision history for this message
Moisés López - (moylop260) wrote :

Searh function() is better.
We are agree.
Thank you


Unmerged revisions

6984. By Julio Serna-

[FIX][mrp] modified function _bom_find to get the BoM considering if active or dates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp/'
--- mrp/ 2012-07-23 08:44:52 +0000
+++ mrp/ 2012-09-12 00:05:23 +0000
@@ -279,7 +279,13 @@
279 @param properties: List of related properties.279 @param properties: List of related properties.
280 @return: False or BoM id.280 @return: False or BoM id.
281 """281 """
282 cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))282 cr.execute(""" select id
283 from mrp_bom where product_id=%s
284 and bom_id is null
285 and active=True
286 and (date_start is null or date_start <= current_date)
287 and (date_stop is null or date_stop >= current_date)
288 order by sequence """, (product_id,))
283 ids = map(lambda x: x[0], cr.fetchall())289 ids = map(lambda x: x[0], cr.fetchall())
284 max_prop = 0290 max_prop = 0
285 result = False291 result = False