Merge branch 'dev' of https://gitee.com/jinan-pengyusen-data/gzth into dev
This commit is contained in:
@@ -114,7 +114,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
elif hasattr(self, 'users_id') and self.users_id:
|
||||
query_user_id = self.users_id.id
|
||||
else:
|
||||
query_user_id = current_user_id
|
||||
query_user_id = self.env.user.id
|
||||
if self.log_ids:
|
||||
if query_user_id == current_user_id and self.work_end and self.log_ids[-1].approval_state in ['0', '1']:
|
||||
self.is_active = True
|
||||
@@ -351,7 +351,7 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
state = '询价'
|
||||
self_state = state_list.index(state)
|
||||
# 当前节点
|
||||
if btn_rec.name != '结束':
|
||||
if btn_rec.name not in ['结束', '归档']:
|
||||
current_node = node_list[state_list.index(state)]
|
||||
self.env['trans.link'].search([]).unlink()
|
||||
# 退回节点根据日志进行判断
|
||||
|
||||
@@ -67,6 +67,34 @@ class HrLeave(models.Model):
|
||||
else:
|
||||
self.request_hour_to = False
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _unlink_if_correct_states(self):
|
||||
"""重写删除校验:先将请假单改为拒绝状态,再执行原生校验/删除"""
|
||||
to_cancel_leaves = self.filtered(lambda r: r.state != 'draft')
|
||||
if to_cancel_leaves:
|
||||
to_cancel_leaves.write({
|
||||
'state': 'draft',
|
||||
'notes': _('%s:删除前自动标记为拒绝') % fields.Datetime.now()
|
||||
})
|
||||
error_message = _('You cannot delete a time off which is in %s state')
|
||||
state_description_values = {elem[0]: elem[1] for elem in self._fields['state']._description_selection(self.env)}
|
||||
if not self.user_has_groups('hr_holidays.group_hr_holidays_user'):
|
||||
for hol in self:
|
||||
if hol.state not in ['draft', 'confirm', 'validate1', 'cancel']:
|
||||
raise UserError(error_message % state_description_values.get(hol.state))
|
||||
if hol.sudo().employee_ids and not hol.employee_id:
|
||||
raise UserError(_('You cannot delete a time off assigned to several employees'))
|
||||
else:
|
||||
for holiday in self.filtered(lambda holiday: holiday.state not in ['draft', 'cancel', 'confirm']):
|
||||
raise UserError(error_message % (state_description_values.get(holiday.state),))
|
||||
|
||||
@api.model
|
||||
def write(self, vals):
|
||||
if not self.env.context.get('leave_skip_state_check'):
|
||||
self = self.with_context(leave_skip_state_check=True)
|
||||
if 'state' not in vals and self.filtered(lambda r: r.state != 'draft'):
|
||||
vals['state'] = 'draft'
|
||||
return super(HrLeave, self).write(vals)
|
||||
|
||||
def action_leave_wizard(self):
|
||||
return {
|
||||
|
||||
@@ -222,7 +222,7 @@ class YuthonOnboardApproval(models.Model):
|
||||
vacation_date = self.duration_employment.replace(day=1)
|
||||
self.env['yuthon.vacation.reports'].search([('employee_id', '=', employee_id.id), ('vacation_date', '=', vacation_date)])
|
||||
if not vacation_date:
|
||||
self.env['yuthon.vacation.reports'].create({
|
||||
self.env['yuthon.vacation.reports'].sudo().create({
|
||||
'employee_id': employee_id.id,
|
||||
'vacation_date': vacation_date,
|
||||
})
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="current_address"/>
|
||||
<field name="phone"/>
|
||||
<field name="phone" required="1"/>
|
||||
<field name="email"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<field name="salary_level" invisible="contract_type != 'internship'"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="phone"/>
|
||||
<field name="phone" required="1"/>
|
||||
<field name="card"/>
|
||||
<field name="job_id" readonly="0"/>
|
||||
<field name="structure_type_id" domain="[('company_id', '=', company_id)]"/>
|
||||
|
||||
@@ -19,6 +19,7 @@ class InheritPurchaseOrder(models.Model):
|
||||
code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_workflow_approval_code'))
|
||||
state = fields.Selection(selection_add=[('申请人', '申请人'), ('部门经理', '部门经理'), ('工会主席', '工会主席'),
|
||||
('协办', '协办'),
|
||||
('复核', '复核'),
|
||||
('分管领导', '分管领导'),
|
||||
('总经理', '总经理'), ('归档', '归档')], default='申请人')
|
||||
work_end = fields.Boolean(string="结束")
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
type="object"
|
||||
string="打印"
|
||||
class="btn-primary" invisible="not work_end"/>
|
||||
<button name="btn_exec_action" string="归档" type="object" class="oe_highlight" invisible="state != 'purchase'" context="{'btn_key':'PN8N28ZNWA','active_model':'purchase.order'}"/>
|
||||
</header>
|
||||
<div class="col-12 text-center">
|
||||
<h1>
|
||||
|
||||
Reference in New Issue
Block a user