I am using V14 is there a way to create a field that will display today's date and automatically update each day?
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,
Try this,
@api.multi
def _compute_current_date(self):
for each in self:
current_date = fields.Date.context_today(self)
each.date = current_date
date = fields.Date(compute='_compute_current_date', string='Current Date')
Note :
1 : Not to give store = True in field definition
2 : Not to give any api.depends in compute function.
Hope it helps,
Thanks
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ý
Try this:
allocation_date= fields.Date('Allotment Date',required=True,default= lambda self:fields.Datetime.now())
Reference: https://sites.google.com/view/thinkincode/erp/odoo