← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/6.0-bug-710521-jvo into lp:openobject-addons/6.0

 

Jay Vora (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-bug-710521-jvo into lp:openobject-addons/6.0.

Requested reviews:
  qdp (OpenERP) (qdp)
  Olivier Dony (OpenERP) (odo)
  OpenERP Core Team (openerp)
Related bugs:
  Bug #710521 in OpenERP Addons: "Pricelist with base price set to 0"
  https://bugs.launchpad.net/openobject-addons/+bug/710521

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-710521-jvo/+merge/55473

Hello Reviewer,

I had to write 'if' condition such a way due to the following reason:

>>> False > 0.0
False
>>> False >= 0.0
True

So, writing 'if price>=0.0' would not suffice the need as it will bypass the False to enter into if loop.

I will still double-check it and will let this proposal be updated.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-710521-jvo/+merge/55473
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-bug-710521-jvo.
=== modified file 'product/pricelist.py'
--- product/pricelist.py	2011-02-15 10:55:46 +0000
+++ product/pricelist.py	2011-03-30 06:29:30 +0000
@@ -264,9 +264,8 @@
                                     product_obj.price_get(cr, uid, [product_id],
                                         price_type.field,context=context)[product_id], round=False, context=context)
 
-                        if price:
+                        if price is not False and price >= 0.0:
                             price_limit = price
-
                             price = price * (1.0+(res['price_discount'] or 0.0))
                             price = rounding(price, res['price_round'])
                             price += (res['price_surcharge'] or 0.0)
@@ -275,6 +274,9 @@
                             if res['price_max_margin']:
                                 price = min(price, price_limit+res['price_max_margin'])
                             break
+                        else:
+                            #if this condition becomes True,price is either False or Negative. Its a bad configuration, so setting the price to be False.
+                            price = False
 
                     else:
                         # False means no valid line found ! But we may not raise an


Follow ups