添加功能
This commit is contained in:
@@ -610,27 +610,22 @@ class SoongWorkflowRecord(models.Model):
|
||||
record_ids = self.env["soong.workflow.record"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id', []))
|
||||
)
|
||||
if not record_ids:
|
||||
return
|
||||
lin_weidong = self.env['res.users'].search([('name', '=', '林伟东')], limit=1)
|
||||
employee_id = self.env['hr.employee'].search([('name', '=', '林伟东')], limit=1)
|
||||
if not lin_weidong:
|
||||
return
|
||||
|
||||
for record in record_ids:
|
||||
self.env['soong.workflow.log2'].create({
|
||||
'model': record.res_model,
|
||||
'res_id': record.res_id,
|
||||
'node_id': record.node_id.id,
|
||||
'done_by': lin_weidong.id,
|
||||
'approval_state': '0',
|
||||
})
|
||||
|
||||
if lin_weidong not in record.users_ids:
|
||||
record.users_ids |= lin_weidong
|
||||
|
||||
if employee_id not in record.employee_ids:
|
||||
record.employee_ids |= employee_id
|
||||
res_model = record.res_model
|
||||
res_id = record.res_id
|
||||
if not res_model or not res_id:
|
||||
continue
|
||||
record_model = self.env[res_model]
|
||||
business_record = record_model.browse(res_id)
|
||||
if not business_record:
|
||||
continue
|
||||
if not hasattr(business_record, 'log_ids'):
|
||||
continue
|
||||
for log in business_record.log_ids:
|
||||
if log.approval_state in ['0', '1']:
|
||||
log.sudo().write({
|
||||
'approval_state': '2'
|
||||
})
|
||||
|
||||
def open_record(self):
|
||||
return {
|
||||
|
||||
@@ -75,6 +75,9 @@ class PropertyFeeSpending(models.Model):
|
||||
|
||||
def finish_work(self):
|
||||
for rec in self:
|
||||
for rec in self:
|
||||
if rec.work_end:
|
||||
continue
|
||||
form_vals = {
|
||||
"name": rec.name,
|
||||
"tip_description": rec.tip_description,
|
||||
|
||||
Reference in New Issue
Block a user