Merge lp:~akretion-team/openobject-addons/trunk-addons-fix-price_get_multi into lp:openobject-addons

Proposed by Alexis de Lattre
Status: Rejected
Rejected by: Martin Trigaux (OpenERP)
Proposed branch: lp:~akretion-team/openobject-addons/trunk-addons-fix-price_get_multi
Merge into: lp:openobject-addons
Diff against target: 12 lines (+1/-1)
1 file modified
product/pricelist.py (+1/-1)
To merge this branch: bzr merge lp:~akretion-team/openobject-addons/trunk-addons-fix-price_get_multi
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+162324@code.launchpad.net

Description of the change

This is a copy-paste of my explaination on the bug report https://bugs.launchpad.net/openobject-addons/+bug/1175983 :

In product/pricelist.py, if you enter the function price_get_multi() with context['date'] = False or None, you will have an error message :
<<
At least one pricelist has no active version ! Please create or activate one.
>>

For example, one scenario where you enter the function function price_get_multi() with context['date'] = False or None is when you use the module "product_visible_discount" :

in product_visible_discount.py line 87, inside the function product_id_change() you have :

list_price = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order })
(the function price_get() calls price_get_multi())

and the default value for the variable "date_order" is False, as you can see in the proto of the function product_id_change().

I think that the proper fix for this is simply to test if context['date'] has a value before using it for the 'date' variable in the function price_get_multi() in product/pricelist.py. My merge proposal implements this fix.

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

Hello,

We have already merged your fix into openerp 7.0 (revision 9470). The code will be forward ported to trunk soon and I will then reject this branch.

Thanks for the code and the report

Unmerged revisions

8697. By Alexis de Lattre

[FIX] Don't raise an error when context['date'] is False or None

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 2013-04-22 15:34:49 +0000
3+++ product/pricelist.py 2013-05-03 10:42:28 +0000
4@@ -150,7 +150,7 @@
5 context = {}
6
7 date = time.strftime('%Y-%m-%d')
8- if 'date' in context:
9+ if 'date' in context and context['date']:
10 date = context['date']
11
12 currency_obj = self.pool.get('res.currency')

Subscribers

People subscribed via source and target branches

to all changes: