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_price_label
| Inputs | Method | Outputs |
|---|---|---|
|
for item in self:
if item.compute_price == 'fixed':
item.price = formatLang(
item.env, item.fixed_price, dp="Product Price", currency_obj=item.currency_id)
- elif item.compute_price == 'percentage':
- percentage = self._get_integer(item.percent_price)
- if item.base_pricelist_id:
- item.price = _(
- "%(percentage)s %% discount on %(pricelist)s",
- percentage=percentage,
- pricelist=item.base_pricelist_id.display_name
- )
- else:
- item.price = _(
- "%(percentage)s %% discount on sales price",
- percentage=percentage
- )
else:
base_str = item._get_price_label_base_str()
extra_fee_str = ""
if item.price_surcharge > 0:
- extra_fee_str = _(
+ extra_fee_str = item.env._(
"+ %(amount)s extra fee",
amount=format_amount(
item.env,
abs(item.price_surcharge),
currency=item.currency_id,
),
)
elif item.price_surcharge < 0:
- extra_fee_str = _(
+ extra_fee_str = item.env._(
"- %(amount)s rebate",
amount=format_amount(
item.env,
abs(item.price_surcharge),
currency=item.currency_id,
),
)
discount_type, percentage = self._get_displayed_discount(item)
- item.price = _("%(percentage)s %% %(discount_type)s on %(base)s %(extra)s",
+ item.price = item.env._("%(percentage)s %% %(discount_type)s on %(base)s %(extra)s",
percentage=percentage,
discount_type=discount_type,
base=base_str,
extra=extra_fee_str,
)
|
|
