Merge pull request !3376 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-06-17 12:04:27 +00:00
committed by Gitee
3 changed files with 21 additions and 14 deletions
@@ -11,13 +11,14 @@
<group invisible="1">
<field name="approval_concatenation" widget="radio"/>
<field name="invalid_link_ids" widget="many2many_tags"/>
<field name="user_role_ids"/>
<field name="comment"/>
</group>
<group invisible="node_btn_name in ['分发', '结束', '收回']">
<div class="oe_comment_block" style=" width:1200%; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin-bottom: 16px;">
<label for="comment_note_id" string="常用意见"
style="font-weight: bold; margin-bottom: 8px; display: block;"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_id.employee_id.user_role_id)]"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_role_ids)]"/>
<field name="comment_note" placeholder="请输入意见内容..." style="width: 100%;"/>
</div>
</group>
@@ -25,7 +26,7 @@
<div class="oe_comment_block" style=" width:1200%; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin-bottom: 16px;">
<label for="comment_note_id" string="结束意见"
style="font-weight: bold; margin-bottom: 8px; display: block;"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_id.employee_id.user_role_id)]"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_role_ids)]"/>
<field name="comment_note" placeholder="请输入意见内容..." style="width: 100%;"/>
</div>
</group>
@@ -33,7 +34,7 @@
<div class="oe_comment_block" style=" width:1200%; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin-bottom: 16px;">
<label for="comment_note_id" string="分发意见"
style="font-weight: bold; margin-bottom: 8px; display: block;"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_id.employee_id.user_role_id)]"/>
<field name="comment_note_id" class="mb-3" style="width: 100%;" options="{'no_create': True}" domain="[('note_setting_id.users_role_ids', 'in', user_role_ids)]"/>
<field name="comment_note" placeholder="请输入意见内容..." style="width: 100%;"/>
</div>
</group>
+16 -10
View File
@@ -39,16 +39,22 @@ class HrContract(models.Model):
documents_ids = fields.Many2many('ir.attachment', string="合同附件")
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company', search='_search_part_of_company')
@api.constrains("state")
def _constrains_state(self):
today = date.today()
if self.date_end:
if self.date_end < today:
self.state = 'close'
elif self.date_end == today:
self.state = 'close'
else:
self.state = 'open'
def write(self, vals):
"""在写入时自动更新合同状态"""
# 先执行状态更新
today = fields.Date.today()
if 'date_end' in vals:
new_end_date = fields.Date.to_date(vals['date_end'])
# 遍历所有要更新的合同
for contract in self:
end_date = new_end_date
if end_date > today:
vals['state'] = 'open'
elif end_date < today:
vals['state'] = 'close'
# 调用原生写入逻辑
return super(HrContract, self).write(vals)
@api.depends_context('uid', 'company')
@api.depends('company_id')
@@ -4,7 +4,7 @@
<field name="name">property.deposit.tree</field>
<field name="model">property.deposit.list</field>
<field name="arch" type="xml">
<tree string="押金列表" editable="bottom" limit="20">
<tree string="押金列表" editable="bottom" limit="20" create="false" delete="false" edit="0">
<field name="property_id"/>
<field name="lessee_id"/>
<field name="is_push" optional="hide"/>