Skip to content

Commit a1f80a4

Browse files
authored
Merge pull request #61 from gisce/71913_add_delete_wiz_act_btn
Añadir el botón para eliminar el enlace a los correos electrónicos relacionados
2 parents 3640010 + 03ddbb5 commit a1f80a4

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
from oopgrade.oopgrade import load_data_records
3+
from tools import config
4+
5+
6+
def up(cursor, installed_version):
7+
if not installed_version:
8+
return
9+
10+
load_data_records(
11+
cursor,
12+
'poweremail_references',
13+
'poweremail_template_view.xml',
14+
['poweremail_template_access_form'],
15+
mode='update'
16+
)
17+
18+
19+
def down(cursor, installed_version):
20+
pass
21+
22+
23+
migrate = up

poweremail_references/poweremail_template.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ def create_access_reference(self, cursor, uid, ids, context=None):
6060

6161
return True
6262

63+
def remove_access_reference(self, cursor, uid, ids, context=None):
64+
if not isinstance(ids, (list, tuple)):
65+
ids = [ids]
66+
67+
for template_id in ids:
68+
template_brw = self.simple_browse(cursor, uid, template_id, context=context)
69+
70+
if template_brw.ref_ir_act_window_access:
71+
template_brw.write({'ref_ir_act_window_access': False})
72+
template_brw.ref_ir_act_window_access.unlink()
73+
74+
if template_brw.ref_ir_value_access:
75+
template_brw.write({'ref_ir_value_access': False})
76+
template_brw.ref_ir_value_access.unlink()
77+
78+
6379
_columns = {
6480
'ref_ir_act_window_access': fields.many2one(
6581
'ir.actions.act_window',

poweremail_references/poweremail_template_view.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
<field name="ref_ir_value_access" colspan="4"/>
1313
<field name="ref_ir_act_window_access" colspan="4"/>
1414
<group>
15-
<label string="" colspan="3"/>
15+
<label string="" colspan="2"/>
16+
<button name="remove_access_reference" colspan="1" string="Remove template emails link" type="object"
17+
attrs="{'readonly':[('ref_ir_act_window_access', '=', False), ('ref_ir_value_access', '=', False)]}"
18+
icon="minus" primary="1" danger="1" />
1619
<button name="create_access_reference" colspan="1" string="Create template emails link" type="object" icon="plus" primary="1"/>
1720
</group>
1821
</page>

0 commit comments

Comments
 (0)