What is it?
The Use-defined Defaults are all the default values that exist in the DB. On the default model, you can see the field, model, user and company that is affected by the default value.
Example New contact made by Mitchell Admin in the company My Company (San Francisco) will have the language English (US) by default. |
Why is it useful?
Some fields cannot have a default value set in the standard way (bug → set Defaults). Going into the User-defined Default allows you to set a default value on any field (if you have Studio you can also have the Condition field on the Defaults form and modify this as well).
Example You can set the pricelist with the ID 4 as default if the contact zipcode is 5020 |
Extra documentation
How to set it up ?
Defaults allow the users to save time and minimize error.
If a specific configuration, information, ... on records should always - or generally - be the same, you can create a default. This default will be used at every new creation of a record.
How to set up a default from a record?
You can set up the value of a field by default by following the following steps:
- Activate the developer mode
- Open the form and populate the field
- for example, I want to use the "tarif" quotation template by default for each quotations

- Click on the debugger button and "Set default values"

- In the pop up, select in the list of the "Default" field what you want to set up by default
- you cannot select fields that are in read-only eg. if your Sale Order is confirmed, the Quotation Template field becomes read-only and cannot be found in the list of the default to use

- Select a Condition or not
- Only a few fields can be used as condition for the default, as it depends on whether or not that field has been defined with change_default .
eg. You can use the ZIP code as a condition in the contact form https://github.com/odoo/odoo/blob/9144eb051538d5a92d403e1ad9c635ce39e090ec/odoo/addons/base/models/res_partner.py#L270
- Only a few fields can be used as condition for the default, as it depends on whether or not that field has been defined with change_default .

- Choose to apply the rule only for you or for all users
- Click on "Save default"
Where are the User-Defined Defaults stored?
Each new default creates a record in the User-Defined Defaults technical menu (Settings > Technical > Action > User-defined Default).

As mentioned above, multiple existing defaults are created when a database is created or when application are installed. Indeed, it is predefined to make a smoother user-experience.



How to set up a default from the technical menu?
Defaults can be created directly from the technical menu, or adapted.
Like for the creation of a default from a record, you will need to indicate for which field this value will be set.
The Default value will depend of the type of the field we are trying to put a default on.
If your field is a Many2One, then - for most fields - the ID of the record to be set, will be used (eg. of an exception is the language on the contact that used the locale code of the language record).
Selection field will use as default value the fields selection value.

The Condition, as mention above is more tricky as only fields that have been defined with change_defaultcan be used.
It must mention the technical name of the field used in the condition as well as the ID or value of that field.
The User field should be left empty if the default is to be applied to all user. When a user is set this default will be only for them.
If the Company field is left empty then this default will be used for all of the companies of the database. Otherwise it will be used only when on that specific company.
Eg. You have multiple companies on the same database, including a french and a dutch company, you want the default language on the contact to be different based on the company, but the default costing method on a category to be the same in all company.
