Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
97 Vizualizări

I have created a custom module in Odoo 18 with a form view for my model.

When I open the form view (without entering any data) and then navigate to another menu or tab, Odoo automatically creates a new record with empty/default values in the database.

This results in multiple “null” or blank records being created unintentionally.


My questions:

  1. Why does Odoo create these empty records?
  2. Is this the default behavior of form views in Odoo, or is it caused by my form view setup?
  3. How can I prevent Odoo from saving a record until the user clicks Save?

Any guidance or best practices for preventing these unwanted blank records would be appreciated.

Imagine profil
Abandonează
Cel mai bun răspuns

If you have default values defined, the form in fact is not empty when navigating away - thus the auto-save feature hits. 


You could define a required field, without an default value, so it can't save when not set.


Alternatively you could extend the create() method and check for whatever makes you feel that the form should get saved now.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 25
720
2
aug. 25
310
3
aug. 25
1053
1
aug. 25
614
3
aug. 25
918