[MODULE] +7.0 version 7.0
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Mon, 7 Nov 2016 16:54:07 +0000 (17:54 +0100)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Mon, 7 Nov 2016 16:54:07 +0000 (17:54 +0100)
__init__.py [new file with mode: 0644]
__openerp__.py [new file with mode: 0644]
static/src/img/icon.png [new file with mode: 0644]
static/src/img/move_line_search_view.png [new file with mode: 0644]
static/src/js/move_line_search_view.js [new file with mode: 0644]

diff --git a/__init__.py b/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/__openerp__.py b/__openerp__.py
new file mode 100644 (file)
index 0000000..5121a68
--- /dev/null
@@ -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:: /account_move_line_no_default_search/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',
+        ],
+}
diff --git a/static/src/img/icon.png b/static/src/img/icon.png
new file mode 100644 (file)
index 0000000..4ac0af9
Binary files /dev/null and b/static/src/img/icon.png differ
diff --git a/static/src/img/move_line_search_view.png b/static/src/img/move_line_search_view.png
new file mode 100644 (file)
index 0000000..2f6eba3
Binary files /dev/null and b/static/src/img/move_line_search_view.png differ
diff --git a/static/src/js/move_line_search_view.js b/static/src/js/move_line_search_view.js
new file mode 100644 (file)
index 0000000..b023a8b
--- /dev/null
@@ -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