コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3050 ビュー

Hi friends,

I want to put a Reset button inside a form and if the user clicks this button in edit/draft mode then reset some fields to default values.

Here are my problems:

  1. Some fields in the form view are of the type required and when I press the Reset button, Odoo makes red these fields before executing my reset function!!! It's annoying.
  2. Fields are of different types (ex. Monetary and others). How can I reset all to the default value at once?
  3. Has Odoo any utility to Reset the form?


アバター
破棄
最善の回答

Hi,

Why to have a new button when we already have a discard button by default in the header ?



Thanks

アバター
破棄
著作者

I have a form with many fields. If I click the Discard button, the form get closed and all filled fields get removed but I don't want that. Suppose we have 100 fields in a form and refilling those is not easy.

but by introducing a new button how will you distinguish which one to keep and which one to reset ?
coming to your question, if you need a make a button clickable bypassing the required fields, there was some apps in the store and also using js it can be done similar to current discard button

著作者

about your question in the first line of your comment, we will have a function that calls when the button is clicked. In the body, we can clear mentioned fields.
But, the main problem is that when you push any Odoo button, before the actual method is executed the current record is saved (either 'created' or 'written'). It means that a check for 'required' and being filled is made before you fill the value in your method.

関連投稿 返信 ビュー 活動
1
4月 24
1354
3
6月 23
1931
1
5月 24
1044
1
9月 23
1759
0
4月 23
1430