auto_save_res_partner
A child list that saves its parent before letting you add a row. Seven lines of code for a problem that otherwise produces confusing errors on brand new contacts.
| Technical name | auto_save_res_partner |
|---|---|
| Field types | one2many, many2many |
| Views | form, with an embedded list |
| Module | account, present wherever Invoicing or Accounting is installed |
| Used in core | 1 occurrence, a partner tax list in the Argentinian withholding localization |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0 |
| No-code setup | No. It is a view XML widget for child lists that need a saved parent |
| Alternatives | one2many, payment_term_line_ids, many2many, many2many_tags_banks |
What the autosaving child list does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
editable | string (list attribute) | Set on the embedded list. Governs inline editing of the child rows, independently of the save on add. |
create | boolean (list attribute) | Set on the embedded list. Turning it off removes the add action, and with it the only thing this widget changes.(default: true) |
delete | boolean (list attribute) | Set on the embedded list. Deletion is untouched by the widget.(default: true) |
The save is unconditional on the add action. There is no option to skip it, and it applies to the model's root record rather than to the field's own record, so on a nested form it is the outermost record that gets saved.
Working examples
One awaited save, and what it does not cover
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Byte-identical to Odoo 19 on the development branch. |
| Odoo 19.0 | Verified | Verified against the shipped source. Unchanged in substance since Odoo 17. |
| Odoo 18.0 | Verified | Identical behavior. |
| Odoo 17.0 | Verified | First version. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. Nothing to do. The widget arrived in Odoo 17 and is unchanged in substance through Odoo 19; the only difference is the module marker comment Odoo 19 dropped across the codebase.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The contact saved itself when I added a line | Intended. The widget saves the root record before adding the row so the child has a real parent. Expected. Fill the contact's required fields before adding child lines. |
| The row is not added and I get a validation error | The save failed, and the widget awaits it before adding. Fix the reported field on the parent, then add the row again. |
| Editing an existing row does not save the parent | Only the add action is overridden. Expected. Save the form as usual. |
| The wrong record was saved on a nested form | The widget saves the model's root record, not the field's own record. Expected. Use it on a top-level form where that is the intended record. |
| Nothing is different from an ordinary list | The parent was already saved, so the extra save had nothing to do. Nothing to fix; the behavior only shows on a new record. |
| Missing widget error | The accounting module is not installed in that database. Install Invoicing or Accounting, or use a plain child list. |
Autosaving child list vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
auto_save_res_partner | Child lists whose new rows need the parent to exist in the database | Awaits a save of the root record before adding a row, and touches nothing else |
| one2many | Child lists whose rows do not need a saved parent | Adds the row immediately, with no save |
payment_term_line_ids | Lists whose new rows must not be discarded | Solves the abandonment problem rather than the unsaved parent problem |
| many2many | Linking existing records | No creation, so the question does not arise |
| many2many_tags_banks | Partner bank accounts as tags | Saves on mount rather than on add, and renders tags |
Frequently asked questions
Why does the contact save when I add a line?+
What happens if the save fails?+
Does it save when I edit an existing row?+
Is it specific to partner bank accounts?+
Which versions have it?+
Localizations that behave like the rest of your Odoo
Country-specific taxes, withholdings and reporting bring their own screens, and they are only as good as the setup underneath. We implement and adapt Odoo fiscal localizations on versions 16 through 19.
Book a free consultation