c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #31911
[Bug 847605] Re: [6.0.3] Incorrect Variable naming in product/pricelist.py - price_get_multi
** Changed in: openobject-addons
Status: Confirmed => In Progress
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
https://bugs.launchpad.net/bugs/847605
Title:
[6.0.3] Incorrect Variable naming in product/pricelist.py -
price_get_multi
Status in OpenERP Addons (modules):
In Progress
Bug description:
Hi this bit of code, while it doesn't cause a bug is really confusing.
Bear in mind this is in an awful function of 98 statements and 54
local variables, so it is hard enough to understand already.
The variable pricelist_version_ids is unnecessary, but even if it were necessary, it should correctly be called pricelist_ids. In fact the whole first block of code could just be reduced to an - if not pricelist_ids:
pricelist_ids = self.pool.get('product.pricelist').search(cr, uid, [], context=context).
next we have plversions_search_args. I get why it has been seperated
out, but it is a bit unnecessary as well. It is only used one time
and only on the next line so why create the variable.
Now there is plversions_ids, which should more correctly be called
pricelist_version_ids (but that was already taken unnecessarily as per
above) but I suppose it is still explanatory.
if pricelist_ids:
pricelist_version_ids = pricelist_ids
else:
# all pricelists:
pricelist_version_ids = self.pool.get('product.pricelist').search(cr, uid, [], context=context)
pricelist_version_ids = list(set(pricelist_version_ids))
plversions_search_args = [
('pricelist_id', 'in', pricelist_version_ids),
'|',
('date_start', '=', False),
('date_start', '<=', date),
'|',
('date_end', '=', False),
('date_end', '>=', date),
]
plversion_ids = product_pricelist_version_obj.search(cr, uid,
plversions_search_args)
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/847605/+subscriptions
References