编辑按钮
This commit is contained in:
@@ -34,10 +34,20 @@ class SoongWorkflowMixin(models.AbstractModel):
|
|||||||
if not hasattr(self, 'self_users_ids') or not hasattr(self, 'work_end'):
|
if not hasattr(self, 'self_users_ids') or not hasattr(self, 'work_end'):
|
||||||
return {'show_edit': True}
|
return {'show_edit': True}
|
||||||
is_current_user = self.env.user.id in self.self_users_ids.ids
|
is_current_user = self.env.user.id in self.self_users_ids.ids
|
||||||
|
# is_modify=True 且当前用户是流程创建人时也允许编辑
|
||||||
|
is_modify_creator = False
|
||||||
|
if hasattr(self, 'is_modify') and self.is_modify:
|
||||||
|
workflow_record = self.env["soong.workflow.record"].search(
|
||||||
|
[("res_model", "=", self._name), ("res_id", "=", self.id), ('reclaim_state', '=', False)], limit=1)
|
||||||
|
if workflow_record and workflow_record.create_uid.id == self.env.user.id:
|
||||||
|
is_modify_creator = True
|
||||||
|
show_edit = (is_current_user and not self.work_end) or is_modify_creator
|
||||||
return {
|
return {
|
||||||
'show_edit': is_current_user and not self.work_end,
|
'show_edit': show_edit,
|
||||||
'self_users_ids': self.self_users_ids.ids,
|
'self_users_ids': self.self_users_ids.ids,
|
||||||
'work_end': self.work_end,
|
'work_end': self.work_end,
|
||||||
|
'is_modify': hasattr(self, 'is_modify') and self.is_modify,
|
||||||
|
'is_modify_creator': is_modify_creator,
|
||||||
}
|
}
|
||||||
|
|
||||||
# @api.model
|
# @api.model
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
<field name="show_badge_count"/>
|
<field name="show_badge_count"/>
|
||||||
<field name="badge_function"/>
|
<field name="badge_function"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='groups_id']" position="attributes">
|
|
||||||
<attribute name="widget">many2many_tags</attribute>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
'views/yuthon_phone_lotter.xml',
|
'views/yuthon_phone_lotter.xml',
|
||||||
'views/menu.xml',
|
'views/menu.xml',
|
||||||
'views/res_groups_views.xml',
|
'views/res_groups_views.xml',
|
||||||
|
'views/ir_ui_menu_views.xml',
|
||||||
],
|
],
|
||||||
'assets': {
|
'assets': {
|
||||||
'web.assets_backend': [
|
'web.assets_backend': [
|
||||||
|
|||||||
Reference in New Issue
Block a user