Skip to Content
Menu
This question has been flagged
1 Reply
1912 Views

Guys what does [product.id] will  do in this type of code?\

"they are Unrelated to each other"


return self._compute_price_rule([(product, quantity, partner)], date=date, uom_id=uom_id)[product.id]
price = product.price_compute(rule.base)[product.id]

price = product.price_compute('list_price')[product.id]
price_tmp = rule.base_pricelist_id._compute_price_rule([(product, qty, partner)], date, uom_id)[product.id][0]

Avatar
Discard
Best Answer

Hi morteza:

The value of product.id will be used to do an index based lookup of the list or dict. 

For example, product.price_compute(rule.base) returns a dictionary with the id of the product used as the key in the dict. 

product.price_compute(rule.base)[product.id] allows you to retrieve the value of the key matching the product.id in the dictionary returned by product.price_compute(rule.base).

Hope this helps.

Avatar
Discard
Related Posts Replies Views Activity
0
May 23
849
0
Nov 22
20
2
Oct 21
3578
1
Apr 21
1574
2
Nov 20
2669