Community mailing list archives

Re: Get default field values that will be in the form beforehand

Naresh Soni
- 08/31/2015 01:05:41
Hi Hieu,

you will find all the default values set on a model in this default_get method. Just override it in you model and call the super then you can modify with your values if you want. But see values set via onchange will not be available as onchange are executed on client. So you need to have the create method also overridden if you want all default + onchange + any manual values entered.


Naresh Soni
Founder and Consultant
Cozy Business Solutions Pvt. Ltd
+91 8866 370537

On 31 August 2015 at 10:28, Hieu Nguyen <> wrote:
I have some form views similar to `account.voucher.receipt.dialog.form` (`odoo/addons/account_voucher/voucher_payment_receipt_view.xml`).

- Some `field` tags get their default values which were defined in the Model,

- Some `field` tags get their default values from on change methods (defined by `on_change` attributes).

I want to bypass these form views and automate the process, so I need to know beforehand these default field values.
In that way, I only need to add additional field values if needed, then call the `create` method on the model. (I'm using Odoo v8).
How can I achieve that without manual tracing the fields and their corresponding default values/onchange functions?

Post to: