Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5212 มุมมอง

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.




อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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")
          
อวตาร
ละทิ้ง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 24
15649
1
ธ.ค. 22
5077
2
ธ.ค. 22
14588
2
มิ.ย. 22
6474
2
มิ.ย. 22
4806