On 2018-04-24 17:53, Udo Spallek wrote: > But the following code (in version 4.0), but it doesn't work, > the view_attribute[2] does not *dynamically* set the > *mode*[3] attribute:: > > > class Template: > __metaclass__ = PoolMeta > __name__ = "product.template" > > > @classmethod > def view_attributes(cls): > res = super(Template, cls).view_attributes() > > res.append(( > "/form/notebook/page[@id='general']/field[@name='products']", > 'mode', > If(Greater(Len(Eval('products')), 1), > 'tree,form', 'form,tree') > )) > return res > > Are there any ideas how it could work? What is missing?
It can not work because clients build first the view before bind it with record values. I think it will be better to have a configuration option that defines if the company is working with variants or not. This configuration will be used to set a proper mode. -- 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-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/20180425074058.GQ10584%40kei.
signature.asc
Description: Digital signature