Variations are actually one of the coolest features of ERP5: if you trade or
produce a product which comes in various sizes, colours, shapes or any other
properties, you can define only one product, assign "variation axes" to them
and then be able to choose allowed - well, variations. Then, when you fill a
price list or a sales order, you don't need to put separate line for each variation
of a product, but just one line for a product and then you fill a matrix of
prices or quantities.
Table of Contents
To be able to set variations on a Product, you first need to define what
variation axes a product can have. For this, you have to write a simple
Go to your product, and run your script in the context of the product. Now see
the "Price" tab in your product - the "Price Variation Axes" is not empty
anymore - it lets you choose one or more of the variation base categories you've set.
For chosen categories associate Product portal type with them in portal type
tool. For above example choose colour and size in Base Categories.
Once you've defined price variation axes, you need a way to define what variation
this product may have. For this, follow these steps (assuming you want to variate by size):
python:'size' in here.getVariationBaseCategoryList()
Now, play with your product, and see what happens. The nice thingy you'll
eventually see at the bottom of the form is called a matrixbox.
You can assign multiple variation axes to the same product, but do not assign
more then three, because this is the maximum a matrixbox can handle (until
someone comes up with a three-dimensional computer screen).
Now you can set default prices for all possible variations of a product. If you
create a Sales Order, you'll be able to type in eventual prices and quantities
for the order; and if you create a Sales Supply, you'll be able to set up even
more sophisticated pricing schemes, all the time using variations.
To fetch variations for variated object methods getVariationText and getVariationTitle
might be used. First one is discouraged because of returning list of relative URLs.
Sometimes second one returns too less information. In this case below code might
display_id = 'translated_title'
# display_id = 'title' # if there is no need for translation