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

Proposed by Julio Serna-http://www.vauxoo.com
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/mrp.py (+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 - http://www.vauxoo.com Pending
Review via email: mp+123865@code.launchpad.net

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.

Thanks!

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

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

Regards!

Unmerged revisions

6984. By Julio Serna-http://www.vauxoo.com

[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
1=== modified file 'mrp/mrp.py'
2--- mrp/mrp.py 2012-07-23 08:44:52 +0000
3+++ mrp/mrp.py 2012-09-12 00:05:23 +0000
4@@ -279,7 +279,13 @@
5 @param properties: List of related properties.
6 @return: False or BoM id.
7 """
8- cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
9+ cr.execute(""" select id
10+ from mrp_bom where product_id=%s
11+ and bom_id is null
12+ and active=True
13+ and (date_start is null or date_start <= current_date)
14+ and (date_stop is null or date_stop >= current_date)
15+ order by sequence """, (product_id,))
16 ids = map(lambda x: x[0], cr.fetchall())
17 max_prop = 0
18 result = False