添加功能
This commit is contained in:
@@ -37,13 +37,8 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
# setattr(record, field, value)
|
||||
# return res
|
||||
|
||||
def write(self, vals):
|
||||
if self._context.get('_correction_skip'):
|
||||
return super(SoongWorkflowMixin, self).write(vals)
|
||||
for record in self:
|
||||
if record.is_modify:
|
||||
record._write({'is_modify': False})
|
||||
return super(SoongWorkflowMixin, self).write(vals)
|
||||
def action_is_modify(self):
|
||||
self.is_modify = False
|
||||
|
||||
@api.model
|
||||
def _compute_default_state(self):
|
||||
@@ -1318,6 +1313,13 @@ class SoongWorkflowMixin(models.AbstractModel):
|
||||
done_el.set("invisible", "1")
|
||||
header_el.append(done_el)
|
||||
|
||||
modify_btn_el = etree.SubElement(header_el, "button")
|
||||
modify_btn_el.set("name", "action_is_modify")
|
||||
modify_btn_el.set("string", "已修正")
|
||||
modify_btn_el.set("type", "object")
|
||||
modify_btn_el.set("invisible", "not is_modify")
|
||||
modify_btn_el.set("class", "btn btn-primary")
|
||||
|
||||
modify_el = etree.Element("field")
|
||||
modify_el.set("name", "is_modify")
|
||||
modify_el.set("invisible", "1")
|
||||
|
||||
@@ -124,7 +124,6 @@ class SoongWorkflowRecord(models.Model):
|
||||
description=f"您有一条流水号为【{rec.code}】标题为【{rec.name}】流程待修正,请尽快修正",
|
||||
url=url, btntxt="详细信息")
|
||||
record = self.env[rec.res_model].sudo().browse(rec.res_id).exists()
|
||||
record = record.with_context(_correction_skip=True)
|
||||
record.is_modify = True
|
||||
|
||||
@api.returns('self', lambda value: value.id)
|
||||
|
||||
@@ -151,14 +151,10 @@ class IssueLibrary(models.Model):
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
def write(self, vals):
|
||||
if self._context.get('_correction_skip'):
|
||||
return super(IssueLibrary, self).write(vals)
|
||||
def action_is_modify(self):
|
||||
for rec in self:
|
||||
if rec.issue_state == 'to_modify':
|
||||
vals['issue_state'] = rec.original_issue_state
|
||||
vals['original_issue_state'] = False
|
||||
return super(IssueLibrary, self).write(vals)
|
||||
rec.issue_state = rec.original_issue_state
|
||||
rec.original_issue_state = False
|
||||
|
||||
def issue_party_approval(self):
|
||||
issue_active_ids = self.env["issue.library"].browse(
|
||||
@@ -326,7 +322,7 @@ class IssueLibrary(models.Model):
|
||||
title="议题修正",
|
||||
description="您有待修正的议题,请尽快修正",
|
||||
url=url, btntxt="详细信息")
|
||||
rec.with_context(_correction_skip=True).write({
|
||||
rec.write({
|
||||
'original_issue_state': rec.issue_state,
|
||||
'issue_state': 'to_modify',
|
||||
'is_confirm': True,
|
||||
|
||||
@@ -150,6 +150,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="议题总库" create="0">
|
||||
<sheet>
|
||||
<header>
|
||||
<button name="action_is_modify" class="btn btn-primary" type="object"
|
||||
string="已修改" invisible="issue_state != 'to_modify'"/>
|
||||
</header>
|
||||
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
|
||||
invisible="urgency_level != 'normal'"/>
|
||||
<widget name="web_ribbon" title="急件" bg_color="text-bg-warning"
|
||||
|
||||
Reference in New Issue
Block a user