mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[ADD] Module to disable the default search values for period and journal
in the account move line search view
This commit is contained in:
48
move_line_no_default_search_period_journal/__openerp__.py
Normal file
48
move_line_no_default_search_period_journal/__openerp__.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
"name" : "Move line search view - disable defaults for period and journal",
|
||||
"version" : "0.1",
|
||||
"author" : "Therp BV",
|
||||
"category": 'Accounting & Finance',
|
||||
'description': """
|
||||
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.
|
||||
|
||||
.. image:: /move_line_no_default_search_period_journal/static/src/img/move_line_search_view.png
|
||||
|
||||
""",
|
||||
'website': 'http://therp.nl',
|
||||
'depends' : [
|
||||
'account',
|
||||
],
|
||||
'js': [
|
||||
'static/src/js/move_line_search_view.js',
|
||||
],
|
||||
'images': [
|
||||
'static/src/img/move_line_search_view.png',
|
||||
],
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
@@ -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.move_line_no_default_search_period_journal = 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);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user