Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Products & Pricelists

Entity: product.pricelist.item

Compute Method: _compute_name

View 17.0 View 18.0
Inputs Method Outputs
  • categ_id
  • applied_on
  • categ_id.display_name
  • product_tmpl_id
  • product_tmpl_id.display_name
  • product_id
  • product_id.display_name
  • compute_price
  • fixed_price
  • currency_id
  • percent_price
  • price_discount
  • price_surcharge
  • display_applied_on
for item in self:
            if item.categ_id and item.applied_on == '2_product_category':
                item.name = _("Category: %s", item.categ_id.display_name)
            elif item.product_tmpl_id and item.applied_on == '1_product':
-                 item.name = _("Product: %s", item.product_tmpl_id.display_name)
+                 item.name = item.product_tmpl_id.display_name
            elif item.product_id and item.applied_on == '0_product_variant':
                item.name = _("Variant: %s", item.product_id.display_name)
+             elif item.display_applied_on == '2_product_category':
+                 item.name = _("All Categories")
            else:
                item.name = _("All Products")
- 
-             if item.compute_price == 'fixed':
-                 item.price = formatLang(
-                     item.env, item.fixed_price, monetary=True, dp="Product Price", currency_obj=item.currency_id)
-             elif item.compute_price == 'percentage':
-                 item.price = _("%s %% discount", item.percent_price)
-             else:
-                 item.price = _("%(percentage)s %% discount and %(price)s surcharge", percentage=item.price_discount, price=item.price_surcharge)
  • name
  • price

Back to entity