X-Git-Url: http://git.cyclocoop.org/?p=burette%2Faccount_move_line_no_default_search.git;a=blobdiff_plain;f=static%2Fsrc%2Fjs%2Fmove_line_search_view.js;fp=static%2Fsrc%2Fjs%2Fmove_line_search_view.js;h=b023a8bad1c78acd0624c9dde05ad21743616835;hp=0000000000000000000000000000000000000000;hb=f03480d88a7800364dd3447201113274d137af3b;hpb=18b1fa976dd7e6a95f5caa7726281889b6a0df99 diff --git a/static/src/js/move_line_search_view.js b/static/src/js/move_line_search_view.js new file mode 100644 index 0000000..b023a8b --- /dev/null +++ b/static/src/js/move_line_search_view.js @@ -0,0 +1,38 @@ +/* + + Copyright (C) 2013 Therp BV + License: GNU AFFERO GENERAL PUBLIC LICENSE + Version 3 or any later version + + Disable default search on the default journal and period + in the javascript search extension on move lines in + openobject-addons/account/static/src/js/account_move_line_quickadd.js +*/ +openerp.account_move_line_no_default_search = function (instance) { + instance.web.account.QuickAddListView.include({ + start: function() { + /* + Set a hook to be honoured in our override of do_search() + so as to prevent a default search on account move lines + on the default period and journal. + */ + this.block_default_search = true; + return this._super.apply(this, arguments); + }, + + do_search: function(domain, context, group_by) { + /* + Check for a flag to block default search + and reset default values when it has been found, + then reset the blocking flag. + */ + if (this.block_default_search === true) { + this.current_journal = null; + this.current_period = null; + this.block_default_search = false; + } + return this._super.apply(this, arguments); + }, + }); +}; + \ No newline at end of file