From 5f95385933c679adc00518ceb4df29e3cd1dbe64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Wed, 22 Apr 2026 11:13:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_catering/models/yuthon_catering.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yuthon_catering/models/yuthon_catering.py b/yuthon_catering/models/yuthon_catering.py index a4860cdf2..61bda71cb 100644 --- a/yuthon_catering/models/yuthon_catering.py +++ b/yuthon_catering/models/yuthon_catering.py @@ -14,9 +14,17 @@ class YuthonCatering(models.Model): entry_date = fields.Date(related='employee_id.entry_date', string="入职时间", store=True) breakfast = fields.Boolean(string='早餐', default=False, group_operator='count_true') lunch = fields.Boolean(string='午餐', default=False, group_operator='count_true') + breakfast_count = fields.Integer(string='早餐人数', compute='_compute_meal_count', store=True) + lunch_count = fields.Integer(string='午餐人数', compute='_compute_meal_count', store=True) menu_day_id = fields.Many2one('yuthon.menu.setting', string='菜单') amount = fields.Float(string='结算费用', compute='_compute_amount', store=True) + @api.depends('breakfast', 'lunch') + def _compute_meal_count(self): + for rec in self: + rec.breakfast_count = 1 if rec.breakfast else 0 + rec.lunch_count = 1 if rec.lunch else 0 + @api.depends('date') def _compute_week_day(self): week_map = {'0': '周一', '1': '周二', '2': '周三', '3': '周四', '4': '周五', '5': '周六', '6': '周日'}