openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #14459
[Bug 1034799] Re: [Trunk/6.1] product: impossible to get a seller delay of 0
Hello Alexandre,
Thanks for reporting!
It has been fixed on lp:~openerp-dev/openobject-addons/trunk-
bug-1034799-amb branch with following revision no and id.
rev no : 7249
rev id : amb@xxxxxxxxxxx-20120814131211-b385ixr3z75hfjpe
Thanks again!
** Changed in: openobject-addons
Status: Confirmed => Fix Committed
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1034799
Title:
[Trunk/6.1] product: impossible to get a seller delay of 0
Status in OpenERP Addons (modules):
Fix Committed
Bug description:
Steps to reproduce:
---------------------------
* set the supplier delay to 0 for a product
* compute the seller_delay for that product : it is 1 and not 0
Analysis:
------------
Abuse of the "a and b or c" construct which is commonly thought to be
the Python equivalent of the C ternary operator leads to bugs. A
review of all uses of that construct should be performed.
Case at hand : it is not possible to get a product seller_delay of 0,
because the function responsible for doing the computation
(product_template._calc_seller) sets the value as:
'seller_delay': main_supplier and main_supplier.delay
or 1,
If there is a main_supplier and the delay is 0, this evaluates to
(True and 0) or 1 = 0 or 1 = 1
Solution
-----------
so the function should be rewritten as:
delay = 1
if main_supplier:
delay = main_supplier.delay
and then using the delay variable in the returned dictionary.
Thanks
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1034799/+subscriptions
References