how to modify the creation form of a task such as it generates a warning message or block when the date deadline is anterior to the created date.
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ờ
You must inherit model project.task and add constrains function (test dates), like this:
@api.one
@api.constrains('name', 'description')
def _check_description(self):
if self.name == self.description:
raise ValidationError("Fields name and description must be different")
Hello,
You have to create your own form and inherit model project.task then create a onchange method to show the warning
def onchange_deadlinedate(self, cr, uid, ids,create_date, deadline_date, context=None):
context = context or {}
warning = {}
if create_date != False and deadline_date != False:
if (deadline_date>=create_date):
warning = {
'message':
Create date Should be greater than dead line date!"
}
return {'warning': warning}
else:
return {'warning': warning}
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ý
Ans: You must inherit model project.task and add constrains function (test dates), like this: ____________________________________________________________________________ @api.one @api.constrains('name', 'description') def _check_description(self): if self.name == self.description: raise ValidationError("Fields name and description must be different") ____________________________________________________________________________ Thanks for the above answer, I am very new to Odoo, please can you orient me on where exactly this contraints should be inserted. Thanks in advance for your reaction and help
You must create own module. See https://www.odoo.com/documentation/8.0/howtos/backend.html