Merge lp:~openerp-dev/openobject-addons/7.0-opw-591314-rha into lp:openobject-addons/7.0

Proposed by Rifakat Husen (OpenERP)
Status: Merged
Merged at revision: 9477
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-591314-rha
Merge into: lp:openobject-addons/7.0
Diff against target: 16 lines (+4/-2)
1 file modified
mrp/mrp.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-591314-rha
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Naresh(OpenERP) Pending
Review via email: mp+158874@code.launchpad.net

Description of the change

Manufacturing neither consider the activation of a bill attached to produceable product nor
check validity time period/activation time period of the particular bill(Valid From-Valid Until).

Deactivated bill of material(BoM) or the bills which does belong to validity period should be
restricted to be used in a manufacturing process.

I enhence checking. Restrict deactivated and invalid BoM in MO.

To post a comment you must log in.
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Helllo Rifakat,
Do you have news?

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello

- don't hard code date format, use the DEFAULT_SERVER_DATETIME_FORMAT variable
- don't user order argument if not needed, here we have already _order = "sequence" on the model
- the '&' in the domain is useless
- pass the context to search

Regards

review: Needs Fixing
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Hi Martin,

Thanks for your review.
I have updated fix except passing context to search(), can't pass context because _bom_find() itself doesn't have context as parameter.

Regards.

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

You are right for the context, thanks for the update, merged into 7.0

revno: 9477 [merge]
revision-id: <email address hidden>

review: Approve

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 2013-09-16 12:34:42 +0000
3+++ mrp/mrp.py 2013-09-24 06:33:53 +0000
4@@ -296,8 +296,10 @@
5 """
6 if properties is None:
7 properties = []
8- cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
9- ids = map(lambda x: x[0], cr.fetchall())
10+ domain = [('product_id', '=', product_id), ('bom_id', '=', False),
11+ '|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
12+ '|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))]
13+ ids = self.search(cr, uid, domain)
14 max_prop = 0
15 result = False
16 for bom in self.pool.get('mrp.bom').browse(cr, uid, ids):