Configure price list per variant


How the custome list_price of a variant? AFAIK the product.product inherit the list_price from template, but how to configure list_price for each product variant?

Thanks in advance!

The list price is a functional field on the variant which by default returns the list price of the product.
You should override this functional field to return the list_price of each variant.

Hope it helps.

1 Like

I am fighting the same thing here. Can you explain how I can override it for dummies?

Thank you

In 5.8, you should write something like:

from trytond.pool import PoolMeta, Pool
from trytond.model import fields

class Product(metaclass=PoolMeta):
      __name__ = 'product.product'

      attribute_list_price = fields.Numeric(
          "Attribute List Price", required=False, digits=price_digits,
          help="The standard attribute price the product is sold at.")

      def list_price_used(self):
          list_price = self.template.get_multivalue('list_price')
          attribute_list_price = self.attribute_list_price
          return list_price + attribute_list_price

      def default_attribute_list_price():
          return Decimal('0')

welll :face_with_hand_over_mouth:
I am dumber than that :sweat_smile:

I am running 5.8 in Docker that is about where things are. I know it is embarrassing but database and python its a kind of magic for me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.