>
> 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 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/cfdbfee6-fc5c-4d41-aa5a-7652638cbafd%40googlegroups.com.

Reply via email to