跳至内容
菜单
此问题已终结
1 回复
2513 查看

hello,

I put 7 boolean fields for days of the week in the lunch.product form And when we define a product, we choose days that the restaurant has that food.

How can I show users when ordering food just the day's food


形象
丢弃
最佳答案

Hi Mitra,

It would be more helpful if you can post your code.

May be based on the day (Mon (0), Tue (1), Wed (2), ..., Sun (6)), you can pass a domain depending on your boolean fields to search the products.

Ex:

# My Odoo Boolean fields for each day
bool_mon, bool_tue, bool_web, ...., bool_sun
day = 1 # Means Tue- You will be able to find it from the current day
domain = []
if day == 1:
    domain.append(('bool_tue', '=', True))
self.env['product.product'].search(domain) # Search the products based on boolean fields and current day


形象
丢弃
相关帖文 回复 查看 活动
0
6月 19
2515
2
7月 24
2662
1
6月 24
5130
1
10月 23
10835
1
10月 23
98