!11847 !11846 餐饮人员配置

Merge pull request !11847 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-06-02 08:12:48 +00:00
committed by Gitee
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -43,6 +43,10 @@ class AiTokenUsageSummary(models.Model):
total_tokens = fields.Integer(string='总 Token', readonly=True)
def init(self):
from odoo.tools import table_exists
# 依赖表 ai_token_usage 可能尚未创建,跳过
if not table_exists(self.env.cr, 'ai_token_usage'):
return
self.env.cr.execute("""
DROP VIEW IF EXISTS ai_token_usage_summary;
CREATE OR REPLACE VIEW ai_token_usage_summary AS (
@@ -39,6 +39,11 @@ class CateringConfChangeWizard(models.TransientModel):
def action_confirm(self):
"""确认:旧记录加失效日期,生成新记录"""
# 检查员工列表是否有变化,无变化则不允许生成新记录
if set(self.conf_id.employee_ids.ids) == set(self.employee_ids.ids):
from odoo.exceptions import ValidationError
raise ValidationError('员工列表未发生变化,无需生成新记录。\n'
'如需放弃操作,请点击下方"取消"按钮。')
today = fields.Date.today()
note = self._compute_change_note()
from odoo.models import Model