← Back to team overview

openerp-india team mailing list archive

[Bug 1034799] Re: [Trunk/6.1] product: impossible to get a seller delay of 0

 

** Branch linked: lp:~openerp-dev/openobject-addons/trunk-
bug-1034799-amb

-- 
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):
  Confirmed

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