~camptocamp/account-financial-tools/add-credit-control-legal-claim-nbi

« back to all changes in this revision

Viewing changes to account_move_line_no_default_search/static/src/js/move_line_search_view.js

[ADD] Module to disable the default search values for period and journal

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
   Copyright (C) 2013 Therp BV
 
4
   License: GNU AFFERO GENERAL PUBLIC LICENSE
 
5
            Version 3 or any later version
 
6
 
 
7
  Disable default search on the default journal and period
 
8
  in the javascript search extension on move lines in
 
9
  openobject-addons/account/static/src/js/account_move_line_quickadd.js
 
10
*/     
 
11
openerp.account_move_line_no_default_search = function (instance) {
 
12
    instance.web.account.QuickAddListView.include({
 
13
        start: function() {
 
14
            /*
 
15
              Set a hook to be honoured in our override of do_search()
 
16
              so as to prevent a default search on account move lines
 
17
              on the default period and journal.
 
18
            */
 
19
            this.block_default_search = true;
 
20
            return this._super.apply(this, arguments);
 
21
        },
 
22
 
 
23
        do_search: function(domain, context, group_by) {
 
24
            /*
 
25
              Check for a flag to block default search
 
26
              and reset default values when it has been found,
 
27
              then reset the blocking flag.
 
28
            */
 
29
            if (this.block_default_search === true) {
 
30
                this.current_journal = null;
 
31
                this.current_period = null;
 
32
                this.block_default_search = false;
 
33
            }
 
34
            return this._super.apply(this, arguments);
 
35
        },
 
36
    });
 
37
};
 
38
                          
 
 
b'\\ No newline at end of file'