Merge lp:~openerp-dev/openobject-addons/6.1-opw-580286-rgo into lp:openobject-addons/6.1

Proposed by Ravi Gohil (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 7027
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-580286-rgo
Merge into: lp:openobject-addons/6.1
Diff against target: 25 lines (+2/-2)
2 files modified
product/pricelist.py (+1/-1)
purchase/purchase.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-580286-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+129396@code.launchpad.net

Description of the change

Hello,

This fix improves wrong values passed to the query parameter(product_id) of the `product.supplierinfo` object.

In V6.1, `product.supplierinfo` object defines `product_id` field like,
'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True),

so, when you query `product.supplierinfo` object, the `id` must be used from `product.template` object and not from `product.product` object.

I have fixed this. Kindly review it.

Thanks.

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

Hello,

This bug was qualified as Already Fixed on Trunk (means that it was already fixed and merged in Trunk). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

7027. By Ravi Gohil (OpenERP)

[FIX] product.product object is used in searching value for product_id field of product.supplierinfo object where as product.template object should be used as product_id is m2o with product.template object(Courtesy: Sébastien LANGE for providing patch) : (Maintenance Case : 580286)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/pricelist.py'
2--- product/pricelist.py 2012-01-31 13:36:57 +0000
3+++ product/pricelist.py 2012-10-12 11:46:25 +0000
4@@ -204,7 +204,7 @@
5
6 if partner:
7 partner_where = 'base <> -2 OR %s IN (SELECT name FROM product_supplierinfo WHERE product_id = %s) '
8- partner_args = (partner, product_id)
9+ partner_args = (partner, tmpl_id)
10 else:
11 partner_where = 'base <> -2 '
12 partner_args = ()
13
14=== modified file 'purchase/purchase.py'
15--- purchase/purchase.py 2012-10-09 12:16:14 +0000
16+++ purchase/purchase.py 2012-10-12 11:46:25 +0000
17@@ -781,7 +781,7 @@
18
19 qty = qty or 1.0
20 supplierinfo = False
21- supplierinfo_ids = product_supplierinfo.search(cr, uid, [('name','=',partner_id),('product_id','=',product.id)])
22+ supplierinfo_ids = product_supplierinfo.search(cr, uid, [('name','=',partner_id),('product_id','=',product.product_tmpl_id.id)])
23 if supplierinfo_ids:
24 supplierinfo = product_supplierinfo.browse(cr, uid, supplierinfo_ids[0], context=context)
25 if supplierinfo.product_uom.id != uom_id: