i need to invisible page after a specific date . so need to compare that date with create 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ờ
Hi,
To make a page invisible after a specific date in Odoo 16, you can create a custom module and use the date_deadline field in the model to set the expiration date. You can then compare the date_deadline with the create_date of the record to check if the page should be visible or not.
In your model add fields,
date_deadline = fields.Date('Expiration Date')
is_visible = fields.Boolean('Is Visible', compute='_compute_is_visible')
@api.depends('create_date', 'date_deadline')
def _compute_is_visible(self):
for page in self:
if not page.date_deadline:
page.is_visible = True
else:
page.is_visible = fields.Date.today() <= page.date_deadline
Now you can add this field is_invisible in attrs for your page
//your fields inside page
Hope this will help you
Thanks
Thanks for your answer.
we don't want to do configure a date in each and every records we just want to invisible page for the records which are created after 25th of march 2023.
You can try like this:
<page string="Page 1" attrs="{'invisible': [('create_date', '>', '2023-03-25 23:59:59')]}" >
//your code
</page>
This solution worked .
Thank you
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ý