添加功能
This commit is contained in:
@@ -29,6 +29,18 @@ class SoongWorkflowLog(models.Model):
|
||||
document_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
active = fields.Boolean(string="归档", default=True)
|
||||
|
||||
display_field = fields.Char(string="显示字段", compute="_compute_display_field")
|
||||
|
||||
@api.depends("lase_click_date", "done_by")
|
||||
def _compute_display_field(self):
|
||||
for record in self:
|
||||
user_name = record.done_by.name or ""
|
||||
if record.lase_click_date:
|
||||
lase_click_date = record.lase_click_date.strftime("%Y-%m-%d")
|
||||
else:
|
||||
lase_click_date = ""
|
||||
record.display_field = f"{user_name}-{lase_click_date}"
|
||||
|
||||
@api.depends("workflow_id", "node_id", "node_btn_id")
|
||||
def _compute_name(self):
|
||||
for rec in self:
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<field name="name" string="" readonly="0"/>
|
||||
<field name="comment" string=""/>
|
||||
<field name="done_by" string=""/>
|
||||
<field name="lase_click_date" string=""/>
|
||||
<field name="done_by" string="" column_invisible="1"/>
|
||||
<field name="display_field" string=""/>
|
||||
<field name="lase_click_date" string="" groups="base.group_system"/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="node_btn_name" string="" groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<field name="document_ids" string="" widget="preview_many2many"/>
|
||||
@@ -75,8 +76,9 @@
|
||||
<field name="sequence" string="" column_invisible="1"/>
|
||||
<field name="name" string="" readonly="0"/>
|
||||
<field name="comment" string=""/>
|
||||
<field name="done_by" string=""/>
|
||||
<field name="lase_click_date" string=""/>
|
||||
<field name="done_by" string="" column_invisible="1"/>
|
||||
<field name="display_field"/>
|
||||
<field name="lase_click_date" string="" groups="base.group_system"/>
|
||||
<field name="approval_state" string=""/>
|
||||
<field name="node_btn_name" string=""/>
|
||||
<field name="document_ids" string="" widget="preview_many2many"/>
|
||||
|
||||
@@ -88,6 +88,54 @@ class YuthonVacationReports(models.Model):
|
||||
)
|
||||
records.write({'vacation_state': 'not_sent'})
|
||||
|
||||
def write(self, vals):
|
||||
result = super(YuthonVacationReports, self).write(vals)
|
||||
if 'vacation_state' in vals and vals['vacation_state'] == 'confirmed':
|
||||
for record in self:
|
||||
if record.leave_ids:
|
||||
record.leave_ids.write({'is_confirm': True})
|
||||
if record.overtime_ids:
|
||||
record.overtime_ids.write({'is_confirm': True})
|
||||
if record.meal_fee_ids:
|
||||
record.meal_fee_ids.write({'is_confirm': True})
|
||||
if record.medical_fee_ids:
|
||||
record.medical_fee_ids.write({'is_confirm': True})
|
||||
if record.other_fee_ids:
|
||||
record.other_fee_ids.write({'is_confirm': True})
|
||||
return result
|
||||
|
||||
def update_is_confirm(self):
|
||||
reports_active_ids = self.env["yuthon.vacation.reports"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in reports_active_ids:
|
||||
if record.vacation_state == 'confirmed':
|
||||
if record.leave_ids:
|
||||
record.leave_ids.write({'is_confirm': True})
|
||||
if record.overtime_ids:
|
||||
record.overtime_ids.write({'is_confirm': True})
|
||||
if record.meal_fee_ids:
|
||||
record.meal_fee_ids.write({'is_confirm': True})
|
||||
if record.medical_fee_ids:
|
||||
record.medical_fee_ids.write({'is_confirm': True})
|
||||
if record.other_fee_ids:
|
||||
record.other_fee_ids.write({'is_confirm': True})
|
||||
|
||||
@api.onchange('vacation_state')
|
||||
def _onchange_vacation_state_confirm(self):
|
||||
"""当状态改为已确认时,更新所有明细的is_confirm为True"""
|
||||
if self.vacation_state == 'confirmed':
|
||||
# 批量更新4个明细字段(处理明细为空的边界情况)
|
||||
if self.leave_ids:
|
||||
self.leave_ids.write({'is_confirm': True})
|
||||
if self.overtime_ids:
|
||||
self.overtime_ids.write({'is_confirm': True})
|
||||
if self.meal_fee_ids:
|
||||
self.meal_fee_ids.write({'is_confirm': True})
|
||||
if self.medical_fee_ids:
|
||||
self.medical_fee_ids.write({'is_confirm': True})
|
||||
if self.other_fee_ids:
|
||||
self.other_fee_ids.write({'is_confirm': True})
|
||||
|
||||
@api.constrains('employee_id', 'vacation_date')
|
||||
def _check_duplicate_monthly_record(self):
|
||||
"""检查是否存在同一员工当月的重复记录"""
|
||||
@@ -740,6 +788,7 @@ class VacationLeaveLine(models.Model):
|
||||
valid_date = fields.Date(string='有效期至')
|
||||
adjust_date = fields.Date(string='调整至')
|
||||
text = fields.Text(string='备注')
|
||||
is_confirm = fields.Boolean(string="是否确认")
|
||||
|
||||
def open_record(self):
|
||||
if self.workflow_record_id:
|
||||
@@ -751,6 +800,9 @@ class VacationLeaveLine(models.Model):
|
||||
'view_mode': 'form',
|
||||
}
|
||||
|
||||
def action_void(self):
|
||||
self.is_void = True
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
return super(VacationLeaveLine, self).create(vals)
|
||||
@@ -793,6 +845,10 @@ class VacationOverline(models.Model):
|
||||
adjust_date = fields.Date(string='调整至')
|
||||
overtime_methods = fields.Selection([('leave', '补休'), ('fee', '加班费结算')], string='加班补偿方式', default='leave')
|
||||
text = fields.Text(string='备注')
|
||||
is_confirm = fields.Boolean(string="是否确认")
|
||||
|
||||
def action_void(self):
|
||||
self.is_void = True
|
||||
|
||||
def open_record(self):
|
||||
if self.workflow_record_id:
|
||||
@@ -852,6 +908,10 @@ class VacationMealLine(models.Model):
|
||||
adjust_date = fields.Date(string='调整至')
|
||||
is_manual = fields.Boolean(string="手动修改")
|
||||
text = fields.Text(string='备注')
|
||||
is_confirm = fields.Boolean(string="是否确认")
|
||||
|
||||
def action_void(self):
|
||||
self.is_void = True
|
||||
|
||||
def open_record(self):
|
||||
if self.workflow_record_id:
|
||||
@@ -904,6 +964,10 @@ class VacationMedicalLine(models.Model):
|
||||
lines = fields.Float(string='额度')
|
||||
is_void = fields.Boolean(string='是否作废', default=False)
|
||||
text = fields.Text(string='备注')
|
||||
is_confirm = fields.Boolean(string="是否确认")
|
||||
|
||||
def action_void(self):
|
||||
self.is_void = True
|
||||
|
||||
def open_record(self):
|
||||
if self.workflow_record_id:
|
||||
@@ -995,6 +1059,7 @@ class VacationOtherLine(models.Model):
|
||||
is_void = fields.Boolean(string='是否作废', default=False)
|
||||
lines = fields.Float(string='天数')
|
||||
text = fields.Text(string='备注')
|
||||
is_confirm = fields.Boolean(string="是否确认")
|
||||
|
||||
def open_record(self):
|
||||
if self.workflow_record_id:
|
||||
|
||||
@@ -152,7 +152,10 @@
|
||||
<field name="allocation_type" optional="hide"/>
|
||||
<field name="is_void"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<field name="is_confirm" column_invisible="1"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm != True" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm == True" type="object" class="btn-primary"/>
|
||||
<button name="action_void" string="作废"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -175,7 +178,9 @@
|
||||
<field name="overtime_methods"/>
|
||||
<field name="is_void"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm != True" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm == True" type="object" class="btn-primary"/>
|
||||
<field name="is_confirm" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -193,7 +198,9 @@
|
||||
<field name="adjust_date"/>
|
||||
<field name="is_void"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm != True" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm == True" type="object" class="btn-primary"/>
|
||||
<field name="is_confirm" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -210,7 +217,9 @@
|
||||
<field name="lines"/>
|
||||
<field name="is_void"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm != True" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm == True" type="object" class="btn-primary"/>
|
||||
<field name="is_confirm" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -227,7 +236,9 @@
|
||||
<field name="adjust_date"/>
|
||||
<field name="is_void"/>
|
||||
<field name="text"/>
|
||||
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm != True" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
|
||||
<button name="unlink" string="删除" invisible="is_confirm == True" type="object" class="btn-primary"/>
|
||||
<field name="is_confirm" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
@@ -9,7 +9,7 @@ class YutransferApproval(models.Model):
|
||||
|
||||
name = fields.Char(string="标题")
|
||||
employee_id = fields.Many2one('hr.employee', string="员工姓名")
|
||||
documents_ids = fields.Many2many('ir.attachment', string='议题附件')
|
||||
documents_ids = fields.Many2many('ir.attachment', string='附件')
|
||||
code = fields.Char(string="编号",
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_leaving_approval_code'))
|
||||
users_id = fields.Many2one('res.users', string="录入人", default=lambda self: self.env.user.id)
|
||||
@@ -26,7 +26,6 @@ class YutransferApproval(models.Model):
|
||||
handover_person_id = fields.Many2one("hr.employee", string="工作接交人")
|
||||
notification_change_id = fields.Many2one("hr.employee", string="告知人员")
|
||||
handover_reason = fields.Text(string="移交原因")
|
||||
notice_documents_id = fields.Many2one('ir.attachment', string="附件")
|
||||
reason = fields.Text(string="正文")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
issues_result = fields.Html(string="会议结果")
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<field name="reason" required="1"/>
|
||||
<field name="issues_result" invisible="is_issues == False"/>
|
||||
<field name="issue_text"/>
|
||||
<field name="notice_documents_id" widget="preview_many2one"/>
|
||||
<field name="documents_id" widget="preview_many2many"/>
|
||||
</group>
|
||||
<group col="4" string="员工信息">
|
||||
<group>
|
||||
|
||||
@@ -1101,14 +1101,14 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_property()</field>
|
||||
</record>
|
||||
<!-- <record id="administrator_forcibly_closes" model="ir.actions.server">-->
|
||||
<!-- <field name="name">管理员强制结束</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="state">code</field>-->
|
||||
<!-- <field name="code">action = model.all_end_approval()</field>-->
|
||||
<!-- <field name="groups_id" eval="[(4, ref('base.group_system'))]"/>-->
|
||||
<!-- </record>-->
|
||||
<record id="administrator_forcibly_closes" model="ir.actions.server">
|
||||
<field name="name">管理员强制结束</field>
|
||||
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.all_end_approval()</field>
|
||||
<field name="groups_id" eval="[(4, ref('base.group_system'))]"/>
|
||||
</record>
|
||||
<record id="update_contract" model="ir.actions.server">
|
||||
<field name="name">一次性</field>
|
||||
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
|
||||
Reference in New Issue
Block a user