Odoo Help

0

[Resolved] Want having no pre-selected filters in journal items

By
Ludovic CHEVALIER
on 7/10/15, 7:43 AM 1,151 views

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?

Anil R. Kesariya
on 7/10/15, 1:46 PM

Just want no period and no journal pre-selected. Thanks for your answer …

L'Heureux-Cyclage, Ludovic CHEVALIER
on 7/10/15, 2:19 PM
1
Ray Carnes
On 12/22/15, 8:50 PM

Have you seen that a module has already been created to address this?

https://www.odoo.com/apps/modules/8.0/account_move_line_no_default_search/

OpenERP 7.0 implements a custom javascript search view for move lines. This search view shows dropdowns for period and journal. By default, these are set to the default journal and (current) period.

This module leaves the search view extension for move lines intact, but disables the default search values for the dropdowns so that you do not have to disable these before entering your own search queries.

Great. This is that I wanted to do. It's a regrettable that no one has showned me that before. Thanks.

L'Heureux-Cyclage, Ludovic CHEVALIER
on 12/23/15, 4:36 AM
0
Ludovic CHEVALIER
On 7/11/15, 4:31 AM

I've made a module to override javascript file

static/src/js/account_move_line_quickadd.js of account module to remove selectable fields (period and journal).

The module is here:

http://git.heureux-cyclage.org/?p=burette/account_move_line_nofilters.git;a=summary


OK. I've just made this module: http://git.heureux-cyclage.org/?p=burette/account_move_line_nofilters.git;a=summary But, when I go to Account/Journal entries/Journal items , no records appear. I have to select a period and a journal to begin to see them. I would all record to be listed by default when we click to this menu. Can someone help me please?

L'Heureux-Cyclage, Ludovic CHEVALIER
on 7/13/15, 6:31 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/10/15, 7:43 AM
Seen: 1151 times
Last updated: 12/23/15, 4:37 AM