On 2018-03-05 05:51, Steven Lightfoot wrote:
> What is the easiest way of filling a selection field dynamically? I need to 
> fill it based on a custom product class that has a description and up to 8 
> can sizes (different products will have different available can sizes)
> 
> Using a classmethod function does not give me the access to the instance 
> values

So use an instance method decorated with fields.depends:
http://doc.tryton.org/4.6/trytond/doc/ref/models/fields.html#trytond.model.fields.Selection.selection


> so I assume that a function field is the way to go but the only examples I 
> can see using a function field is to set a value from a predefined list.

Function field works the same way as standard field.

> Should I be going down the route of using One2Many, Many2one fields? 

It is also an option, it depends of the schema.


But did you considered to use the product_attribute ? It seems to be
exactly the solution to your "product class".
-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20180305142628.GF4221%40kei.

Reply via email to