Hello Odoo community!
I write a function that calculates day and then return today food ,how can i use this output as domain of product_id field?
column:
product_id = fields.Many2one('lunch.product', 'Product', required=True , domain="[???]")
my function:
def _menu(self):
"""
Prevents menu list
"""
day = self.env['lunch.menu'].search([]).mapped('day')
order_day = self.env['lunch.order'].search([]).mapped('date')
day_name = datetime.datetime.now().strftime('%A')
res={}
for order in self:
for d in range (0,len(day)):
if day[d] == day_name:
menu = self.env['lunch.menu'].search([('day' ,'=' ,day_name)]).mapped('product.id')
return menu
You must read this docs: Learn OpenERP is a great platform where you can specially learn OpenERP (odoo) and its programming concepts from A to Z. The purpose of creating this blog is to help those people who wants to develop their own OpenERP Systems. Have a look please:
https://goo.gl/8HgnCF