← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal into lp:account-financial-tools

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal into lp:account-financial-tools.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal/+merge/207841

Adding a small module "Move line search view - disable defaults for period and journal"

>From the module 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.

-- 
https://code.launchpad.net/~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal/+merge/207841
Your team Account Core Editors is requested to review the proposed merge of lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal into lp:account-financial-tools.
=== added directory 'move_line_no_default_search_period_journal'
=== added file 'move_line_no_default_search_period_journal/__init__.py'
=== added file 'move_line_no_default_search_period_journal/__openerp__.py'
--- move_line_no_default_search_period_journal/__openerp__.py	1970-01-01 00:00:00 +0000
+++ move_line_no_default_search_period_journal/__openerp__.py	2014-02-23 20:02:18 +0000
@@ -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',
+        ],
+}

=== added directory 'move_line_no_default_search_period_journal/static'
=== added directory 'move_line_no_default_search_period_journal/static/src'
=== added directory 'move_line_no_default_search_period_journal/static/src/img'
=== added file 'move_line_no_default_search_period_journal/static/src/img/icon.png'
Binary files move_line_no_default_search_period_journal/static/src/img/icon.png	1970-01-01 00:00:00 +0000 and move_line_no_default_search_period_journal/static/src/img/icon.png	2014-02-23 20:02:18 +0000 differ
=== added file 'move_line_no_default_search_period_journal/static/src/img/move_line_search_view.png'
Binary files move_line_no_default_search_period_journal/static/src/img/move_line_search_view.png	1970-01-01 00:00:00 +0000 and move_line_no_default_search_period_journal/static/src/img/move_line_search_view.png	2014-02-23 20:02:18 +0000 differ
=== added directory 'move_line_no_default_search_period_journal/static/src/js'
=== added file 'move_line_no_default_search_period_journal/static/src/js/move_line_search_view.js'
--- move_line_no_default_search_period_journal/static/src/js/move_line_search_view.js	1970-01-01 00:00:00 +0000
+++ move_line_no_default_search_period_journal/static/src/js/move_line_search_view.js	2014-02-23 20:02:18 +0000
@@ -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);
+        },
+    });
+};
+                          
\ No newline at end of file


Follow ups