Merge pull request !9345 from 李鹏宇/dev
This commit is contained in:
@@ -22,6 +22,16 @@ class YuthonMenuSetting(models.Model):
|
||||
)
|
||||
menu_date = fields.Date(string='日期')
|
||||
remake = fields.Text(string='备注')
|
||||
week_day = fields.Char(string='星期', compute='_compute_week_day', store=True)
|
||||
|
||||
@api.depends('menu_date')
|
||||
def _compute_week_day(self):
|
||||
week_map = {'0': '周一', '1': '周二', '2': '周三', '3': '周四', '4': '周五', '5': '周六', '6': '周日'}
|
||||
for record in self:
|
||||
if record.menu_date:
|
||||
record.week_day = week_map[str(record.menu_date.weekday())]
|
||||
else:
|
||||
record.week_day = ''
|
||||
|
||||
|
||||
class YuthonDishesSetting(models.Model):
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="菜单配置" editable="bottom" js_class="custom_catering_button">
|
||||
<field name="menu_date"/>
|
||||
<field name="week_day"/>
|
||||
<field name="breakfast_ids" widget="many2many_tags" domain="[('dishes_type','=','breakfast')]"/>
|
||||
<field name="lunch_ids" widget="many2many_tags" domain="[('dishes_type','=','lunch')]"/>
|
||||
<field name="remake"/>
|
||||
|
||||
Reference in New Issue
Block a user