diff --git a/addons/account/static/src/js/move_line_quickadd.js b/addons/account/static/src/js/move_line_quickadd.js deleted file mode 100644 index 725440d9066..00000000000 --- a/addons/account/static/src/js/move_line_quickadd.js +++ /dev/null @@ -1,106 +0,0 @@ -odoo.define('account.move_line_quickadd', function (require) { -"use strict"; - -var core = require('web.core'); -var data = require('web.data'); -var ListView = require('web.ListView'); -var Model = require('web.DataModel'); -var view_registry = require('web.view_registry'); - -var QWeb = core.qweb; - -var QuickAddListView = ListView.extend({ - init: function() { - this._super.apply(this, arguments); - this.journals = []; - this.periods = []; - this.current_journal = null; - this.current_period = null; - this.default_period = null; - this.default_journal = null; - this.current_journal_type = null; - this.current_journal_currency = null; - this.current_journal_analytic = null; - }, - start:function(){ - var tmp = this._super.apply(this, arguments); - var self = this; - var defs = []; - this.$el.parent().prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this})); - - this.$el.parent().find('.oe_account_select_journal').change(function() { - self.current_journal = this.value === '' ? null : parseInt(this.value); - self.do_search(self.last_domain, self.last_context, self.last_group_by); - }); - this.$el.parent().find('.oe_account_select_period').change(function() { - self.current_period = this.value === '' ? null : parseInt(this.value); - self.do_search(self.last_domain, self.last_context, self.last_group_by); - }); - this.on('edit:after', this, function () { - self.$el.parent().find('.oe_account_select_journal').attr('disabled', 'disabled'); - self.$el.parent().find('.oe_account_select_period').attr('disabled', 'disabled'); - }); - this.on('save:after cancel:after', this, function () { - self.$el.parent().find('.oe_account_select_journal').removeAttr('disabled'); - self.$el.parent().find('.oe_account_select_period').removeAttr('disabled'); - }); - var mod = new Model("account.move.line", self.dataset.context, self.dataset.domain); - defs.push(mod.call("default_get", [['journal_id','period_id'],self.dataset.context]).then(function(result) { - self.current_period = result['period_id']; - self.current_journal = result['journal_id']; - })); - defs.push(mod.call("list_journals", []).then(function(result) { - self.journals = result; - })); - defs.push(mod.call("list_periods", []).then(function(result) { - self.periods = result; - })); - return $.when(tmp, defs); - }, - do_search: function(domain, context, group_by) { - var self = this; - this.last_domain = domain; - this.last_context = context; - this.last_group_by = group_by; - this.old_search = _.bind(this._super, this); - var o; - self.$el.parent().find('.oe_account_select_journal').children().remove().end(); - self.$el.parent().find('.oe_account_select_journal').append(new Option('', '')); - for (var i = 0;i < self.journals.length;i++){ - o = new Option(self.journals[i][1], self.journals[i][0]); - if (self.journals[i][0] === self.current_journal){ - self.current_journal_type = self.journals[i][2]; - self.current_journal_currency = self.journals[i][3]; - self.current_journal_analytic = self.journals[i][4]; - $(o).attr('selected',true); - } - self.$el.parent().find('.oe_account_select_journal').append(o); - } - self.$el.parent().find('.oe_account_select_period').children().remove().end(); - self.$el.parent().find('.oe_account_select_period').append(new Option('', '')); - for (var i = 0;i < self.periods.length;i++){ - o = new Option(self.periods[i][1], self.periods[i][0]); - self.$el.parent().find('.oe_account_select_period').append(o); - } - self.$el.parent().find('.oe_account_select_period').val(self.current_period).attr('selected',true); - return self.search_by_journal_period(); - }, - search_by_journal_period: function() { - var self = this; - var domain = []; - if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]); - if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]); - self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal; - if (self.current_period === null) delete self.last_context["period_id"]; - else self.last_context["period_id"] = self.current_period; - self.last_context["journal_type"] = self.current_journal_type; - self.last_context["currency"] = self.current_journal_currency; - var compound_domain = new data.CompoundDomain(self.last_domain, domain); - self.dataset.domain = compound_domain.eval(); - return self.old_search(compound_domain, self.last_context, self.last_group_by); - }, -}); - -view_registry.add('tree_account_move_line_quickadd', QuickAddListView); - -}); diff --git a/addons/account/views/account.xml b/addons/account/views/account.xml index d53f8da5bd9..889e732967b 100644 --- a/addons/account/views/account.xml +++ b/addons/account/views/account.xml @@ -11,7 +11,6 @@ - diff --git a/addons/mass_mailing/static/src/js/mass_mailing.js b/addons/mass_mailing/static/src/js/mass_mailing.js index f8e37a11109..88237f9fdf6 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing.js +++ b/addons/mass_mailing/static/src/js/mass_mailing.js @@ -3,7 +3,6 @@ odoo.define('mass_mailing.mass_mailing', function (require) { var FieldTextHtml = require('web_editor.backend').FieldTextHtml; var KanbanRecord = require('web.KanbanRecord'); var KanbanColumn = require('web.KanbanColumn'); -var KanbanView = require('web.KanbanView'); KanbanRecord.include({ on_card_clicked: function (event) { @@ -24,17 +23,8 @@ KanbanColumn.include({ }, }); -KanbanView.include({ - on_groups_started: function() { - this._super.apply(this, arguments); - if (this.dataset.model === 'mail.mass_mailing') { - this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); - } - }, -}); - FieldTextHtml.include({ - get_datarecord: function() { + get_datarecord: function () { /* Avoid extremely long URIs by whitelisting fields in the datarecord that get set as a get parameter */ var datarecord = this._super(); diff --git a/addons/sales_team/static/src/js/sales_team.js b/addons/sales_team/static/src/js/sales_team.js index 7d54401199a..2f817d155dd 100644 --- a/addons/sales_team/static/src/js/sales_team.js +++ b/addons/sales_team/static/src/js/sales_team.js @@ -1,47 +1,10 @@ odoo.define('sales_team.update_kanban', function (require) { "use strict"; -var KanbanView = require('web.KanbanView'); var KanbanRecord = require('web.KanbanRecord'); -var data = require('web.data'); -var session = require('web.session'); - -KanbanView.include({ - crm_display_members_names: function() { - /* - * Set avatar title for members. - * In kanban views, many2many fields only return a list of ids. - * We can implement return value of m2m fields like [(1,"Adminstration"),...]. - */ - var self = this; - var members_ids = []; - - // Collect members ids - self.$el.find('img[data-member_id]').each(function() { - members_ids.push($(this).data('member_id')); - }); - - // Find their matching names - var dataset = new data.DataSetSearch(self, 'res.users', session.context, [['id', 'in', _.uniq(members_ids)]]); - dataset.read_slice(['id', 'name']).done(function(result) { - _.each(result, function(v) { - // Set the proper value in the DOM - self.$el.find('img[data-member_id=' + v.id + ']').attr('title', v.name).tooltip(); - }); - }); - }, - on_groups_started: function() { - var self = this; - self._super.apply(self, arguments); - - if (self.dataset.model === 'crm.team') { - self.crm_display_members_names(); - } - }, -}); KanbanRecord.include({ - on_card_clicked: function() { + on_card_clicked: function () { if (this.model === 'crm.team') { this.$('.oe_kanban_crm_salesteams_list a').first().click(); } else { @@ -49,5 +12,4 @@ KanbanRecord.include({ } }, }); - });