跳至內容
選單
此問題已被標幟
1 回覆
59 瀏覽次數

I have created a custom form in my custom module. The form does not have any required fields, and I also added a Submit button.

The issue is: whenever I type or select anything in the form, due to Odoo’s auto-save functionality, a record is created in the database without clicking the Submit button.

I want to avoid this auto-save behavior so that a record is only created when I click on the Submit button.

How can I achieve this without using a wizard or setting edit="false" / create="false"? Based on my logic, I cannot use those approaches.

頭像
捨棄
最佳答案

Hello navedhusain,

In Odoo, a <form> view is always tied to a record.

When you type in a new form, Odoo must create() a record so it has an id to track changes and run onchange. That’s why auto-save happens.

👉 Therefore, you cannot disable auto-save in a standard form view unless you:

  1. Use a TransientModel (temporary model).
  2. Override JS controllers (FormController / FormRenderer).
  3. Set edit="false" / create="false".

⚠️ There’s no XML option to turn off auto-save.

✅ Odoo-native solution:

  • Use a TransientModel for your form (it doesn’t have to be a popup wizard).
  • On Submit, explicitly create the real record in your main model.

👉 Short answer:

Without a TransientModel or JS override, it’s impossible to avoid auto-save in Odoo forms.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 25
195
0
8月 25
121
1
8月 25
300
3
8月 25
296
1
8月 25
461