On 2016-05-23 02:36, Maxime Richez wrote: > Hello, > > Is it possible to define a default value in a field that depends on the > previously entered data? > > For example, I have a model with detail rows (product, quantity, > prix_unitaire, currency): > > By default the value of my currency is the currency of my company. > If I have to introduce more detail lines with a currency different from > that of my company, to avoid to select this currency every time, is it > possible to imagine that the default value of the currency come from the > value of the previous detail row (and if it's the first line the currency > of the company)?
If it is stored in the database, then you can make a query to find the last entered. But this works only if it is stored in the database so not for One2Many list. > did the context keeps the last entered values? No, nothing is stored in the context. The context is a static things. For the One2Many case, it is usually better to not store default value on the line but one at the parent. -- 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/20160523110319.GW13326%40tetsuo.