Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remove action button #136

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions poweremail_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
7 changes: 7 additions & 0 deletions poweremail_template_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@
attrs="{'readonly':[('ref_ir_act_window', '!=', False), ('ref_ir_value', '!=', False)]}"
icon="gtk-execute"
/>
<button
string="Remove action and value"
colspan="1" name="remove_action_reference"
type="object"
attrs="{'readonly':[('ref_ir_act_window', '!=', True), ('ref_ir_value', '!=', True)]}"
icon="gtk-execute"
/>
<separator string="Expression builder" colspan="4"/>
<field name="template_language" on_change="onchange_null_value(model_object_field,sub_model_object_field,null_value,template_language,context)" colspan="4"/>
<notebook colspan="4">
Expand Down