Pricelist : Error when context['date']=False

Bug #1175983 reported by Alexis de Lattre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP Publisher's Warranty Team

Bug Description

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 merged proposal that will be attached to this bug implements this fix.

Tags: maintenance

Related branches

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I forgot to mention that I found this bug in OpenERP 6.1, but the code is the same in OpenERP 7.0 and trunk.

Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Nhomar - Vauxoo (nhomar)
Changed in openobject-addons:
importance: Undecided → Medium
Revision history for this message
Ravi Gohil (OpenERP) (rgo-openerp) wrote :

Hi,

Thanks for pointing this issue and the root cause.

I have created branch for V6.1 and V7,
lp:~openerp-dev/openobject-addons/6.1-opw-592247-rgo
lp:~openerp-dev/openobject-addons/7.0-opw-592247-rgo

These branches will soon be reviewed and will be merged with main stable branch.

Changed in openobject-addons:
status: New → Fix Committed
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

We have merged Alexis's fix into openerp 7.0. Thanks for the report

Regards

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

Changed in openobject-addons:
status: Fix Committed → Fix Released
Changed in openobject-addons:
milestone: none → 7.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.