Hi!
I'm trying to replace period and journal default filter from journal entries ( Menu Account/Journal entries/Journal items) by blank.
These default filters are defined in addons/account/static/src/js/account_move_line_quickadd.js
45: defs.push(mod.call("default_get", [['journal_id','period_id'],self.dataset.context]).then(function(result) {
46: self.current_period = result['period_id'];
47: self.current_journal = result['journal_id'];
48: }));
I'm not already comfortable with javascript. But, if I remove line 46 and 47, it works fine.
Now, I want to do that without modify account module. So I tried to make a module and I read this doc page: https://doc.odoo.com/trunk/training/web_framework/
Here is my code:
openerp.mymodule.quickadd = function (instance) {
instance.mymodule.quickadd = instance.web.account.QuickAddListView.extend({
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 instance.web.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) {
}));
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);
},
});
};
But, that doesn't work.
Is someone can help me please?
You mean you totally want to remove both selection from there? you want all the journal items to be display?
Just want no period and no journal pre-selected. Thanks for your answer …