添加功能

This commit is contained in:
李鹏宇
2026-06-11 11:35:12 +08:00
parent 5bed1b7f07
commit 0ee6199b0a
3 changed files with 15 additions and 1 deletions
@@ -17,6 +17,15 @@ class YuthonDutyPlan(models.Model):
white_line_ids = fields.One2many('white.plan.line', 'duty_plan_id', string='关联常白班')
notice = fields.Text(string='计划说明')
zu = fields.Integer(string='值班组')
scheduled_month = fields.Integer(string='已排到月份', compute='_compute_scheduled_month', store=True)
@api.depends('plan_line_ids')
def _compute_scheduled_month(self):
for rec in self:
last_slot = self.env['planning.slot'].search(
[('role_id.name', '=', '联安粮库')],
order='start_datetime desc', limit=1)
rec.scheduled_month = last_slot.start_datetime.month if last_slot else 0
@api.onchange('plan_line_ids', 'white_line_ids')
def _onchange_sync_lianan_role_employees(self):
@@ -36,6 +36,7 @@
</group>
<group>
<field name="start_index_time"/>
<field name="scheduled_month"/>
<field name="end_index_time"/>
<field name="is_enable"/>
</group>
@@ -15,15 +15,19 @@
invisible="not is_avoid" options="{'no_create': True}"
domain="[('id', 'in', issue_filter_ids)]"/>
<field name="avoid_comment" invisible="not is_avoid" placeholder="请输入回避意见..."/>
<field name="avoid_employee_ids" widget="many2many_tags" invisible="not is_avoid"/>
</xpath>
<!-- 结束区域:插入 avoid 字段 -->
<xpath expr="//group[.//field[@name='document_ids']]/preceding-sibling::div//field[@name='comment_note']" position="after">
<xpath expr="//group[@invisible=&quot;node_btn_name != '结束'&quot;]//field[@name='circulated_employee_ids']" position="after">
<field name="is_avoid"
invisible="res_model not in ['issue.party.approval', 'issue.boss.approval', 'issue.class.approval']"/>
<field name="issue_filter_ids" invisible="1"/>
<field name="avoid_issue_ids" widget="many2many_tags"
invisible="not is_avoid" options="{'no_create': True}"
domain="[('id', 'in', issue_filter_ids)]"/>
<field name="avoid_comment" invisible="not is_avoid" placeholder="请输入回避意见..."/>
<field name="avoid_employee_ids" widget="many2many_tags" invisible="not is_avoid"/>
</xpath>
</field>