From e17f32dfaf119d2d347cb195859a89da95a1209c Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Thu, 29 Jun 2023 22:24:28 -0400 Subject: [PATCH] Added some helpful comments to the xml and JS. --- bemade_mailcow_blacklist/static/src/js/mailcow_mailbox.js | 4 ++++ bemade_mailcow_blacklist/static/src/xml/mailcow_mailbox.xml | 2 +- bemade_mailcow_blacklist/views/mailcow_mailbox_views.xml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bemade_mailcow_blacklist/static/src/js/mailcow_mailbox.js b/bemade_mailcow_blacklist/static/src/js/mailcow_mailbox.js index 15ffe41..41186c9 100644 --- a/bemade_mailcow_blacklist/static/src/js/mailcow_mailbox.js +++ b/bemade_mailcow_blacklist/static/src/js/mailcow_mailbox.js @@ -5,16 +5,19 @@ import ListView from 'web.ListView'; const viewRegistry = require('web.view_registry'); const MailboxesListController = ListController.extend({ + // buttons_template must match the t-name on the template for the button (static xml) buttons_template: 'mail.mailcow_mailbox_list_view_buttons', events: _.extend({}, ListController.prototype.events, { 'click .o_button_sync_mailboxes': '_onSyncMailboxes', }), + // This may need to be async function() if there needs to be an await this._rpc({ ... }); call to not reload early _onSyncMailboxes: function () { this._rpc({ model: 'mail.mailcow.mailbox', method: 'sync_mailboxes', args: [], }); + // Couldn't test this for real, but it runs the action. May need a this.reload() }, }); @@ -24,4 +27,5 @@ const MailboxesListView = ListView.extend({ }), }); +// key must match with the js_class attribute of the tree view you want to modify viewRegistry.add('mail_mailcow_mailbox_tree', MailboxesListView); diff --git a/bemade_mailcow_blacklist/static/src/xml/mailcow_mailbox.xml b/bemade_mailcow_blacklist/static/src/xml/mailcow_mailbox.xml index 13cc1ab..e179359 100644 --- a/bemade_mailcow_blacklist/static/src/xml/mailcow_mailbox.xml +++ b/bemade_mailcow_blacklist/static/src/xml/mailcow_mailbox.xml @@ -1,6 +1,6 @@ - +