i faced this problem because attrs-> required didn't work
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi
You can use required=True in the py file where the field is defined, otherwise in the XML View
<field name="field_name" required="1"</field>
if it is an inherited view use the position attributes
<attribute name="required">1</attribute>
Regards
try this way:
example:
- Make sure that in your model, the field amount_total has the attribute required=True:
from odoo import models, fields
class MyModel(models.Model):
_name = 'my.model'
amount_total = fields.Monetary(string='Total Amount', required=True)
# Other fields and methods
- In your view's XML definition, ensure that the required attribute is correctly set for the field:
field name="amount_total" required="1"/>
i make it in python and in xml but still didn't work
You can use api constrains to check if the value in the monetary field as greater than 0.0 or not
it's work ,
thanks Bella James
for your answer
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký