[IMP] *: remove deprecated view extensions

* account, mass_mailing, sales_team

These view extensions have already been ignored for around two years.
The new views development is a great opportunity to remove them.
This commit is contained in:
qsm-odoo
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent 41162190a6
commit 19e86c8388
4 changed files with 2 additions and 157 deletions
@@ -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);
});
-1
View File
@@ -11,7 +11,6 @@
<script type="text/javascript" src="/account/static/src/js/reconciliation/reconciliation_model.js"></script>
<script type="text/javascript" src="/account/static/src/js/reconciliation/reconciliation_renderer.js"></script>
<script type="text/javascript" src="/account/static/src/js/move_line_quickadd.js"></script>
<!-- <script type="text/javascript" src="/account/static/src/js/tour_bank_statement_reconciliation.js"></script> -->
<script type="text/javascript" src="/account/static/src/js/account_payment_widget.js"></script>
</xpath>
@@ -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();
+1 -39
View File
@@ -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({
}
},
});
});