Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5227 Visualizzazioni

Hi,

I added a compute field and do the calculation in function through when quantity is 0 or less than 0 popup error message. but when I go back trying to open form view I can't open the because error message comes.

I need to know is there any possibility to pop up an error message when I used to compute field.




Avatar
Abbandona
Risposta migliore

Hi Dishan,


Try to write an onchange function instead. So the function will only trigger when the value in your field is changed. Also make sure you add a check to not show the error when there is no value in the field.


@api.onchange('value')
def _onchange_value(self):
if self.value:
if self.value <= 0:
raise UserError("Error")
          
Avatar
Abbandona

How can this be done in the front end while creating a custom field

Post correlati Risposte Visualizzazioni Attività
2
feb 24
15652
1
dic 22
5080
2
dic 22
14592
2
giu 22
6483
2
giu 22
4814