diff --git a/poweremail_template.py b/poweremail_template.py
index 847eadd..f2baa46 100644
--- a/poweremail_template.py
+++ b/poweremail_template.py
@@ -1131,6 +1131,18 @@ def create_action_reference(self, cursor, uid, ids, context):
'ref_ir_value': ref_ir_value,
}, context)
+ def remove_action_reference(self, cursor, uid, ids, context):
+ template = self.pool.get('poweremail.templates').browse(
+ cursor, uid, ids[0]
+ )
+ if not template.ref_ir_act_window:
+ if not template.ref_ir_value:
+ return
+ self.write(cursor, uid, ids, {
+ 'ref_ir_act_window': None,
+ 'ref_ir_value': None,
+ })
+
poweremail_templates()
diff --git a/poweremail_template_view.xml b/poweremail_template_view.xml
index 5045671..0e96338 100644
--- a/poweremail_template_view.xml
+++ b/poweremail_template_view.xml
@@ -147,6 +147,13 @@
attrs="{'readonly':[('ref_ir_act_window', '!=', False), ('ref_ir_value', '!=', False)]}"
icon="gtk-execute"
/>
+