On 24 maig de 2016 17:01:00 CEST, Maxime Richez <[email protected]> wrote: > > >> >> I think in this case, it is better to define a default one on the >parent >> and use the on_change like @pokoli said to change the default value >to >> this default defined on the parent. >> >> > >I follow your advice but how to force the "on_change_with" be executed >and >set the default value when the form is opened ? Here's is the code of >my on >change: > >@fields.depends('_parent_purchase_requisition.currency') > def on_change_with_currency(self): >currency = self.purchase_requisition.currency if >self.purchase_requisition >else None > if currency: > return currency.id > else: > Company = Pool().get('company.company') > company = Transaction().context.get('company') > if company: > company = Company(company) > return company.currency.id >
You should add purchase_requisition on fields depends, and then it will be called when creating a new record from the One2Many. > -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- 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/45B9631C-FD76-4681-B6A7-32EEAC9FE69A%40koolpi.com.
