Merge lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 173
Proposed branch: lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 106 lines (+86/-0)
2 files modified
account_move_line_no_default_search/__openerp__.py (+48/-0)
account_move_line_no_default_search/static/src/js/move_line_search_view.js (+38/-0)
To merge this branch: bzr merge lp:~therp-nl/account-financial-tools/7.0-add_move_line_no_default_search_period_journal
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Pedro Manuel Baeza code review and test Approve
Review via email: mp+207841@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Stefan,

Indeed, default behaviour annoy me a lot because of the limitations it imposes: if you have powerful filters and groups, why do you need this? But maybe it's better to have a separate view without these limitations so that anyone that has already work with OpenERP don't lose this view, and to avoid we can get original view if the other gets broken by anything. Sometimes, original view is even useful, hehe.

What do you think?

Regards.

review: Needs Information
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Pedro, thanks for your input. I have a feeling that having an additional view and menu item would feel cramped and could easily confuse people so I think that having this optional module to change the default search setting for every user of the database is the right level.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Turns out I need to resolve the following issue: the icon path in the module table can only contain 64 chars, while move_line_no_default_search_period_journal/static/src/img/icon.png is 66 characters :-(

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I suggest to change name to account_move_line_no_default_search:

- It includes account prefix for account related stuff.
- It's descriptive enough
- It's shorter than previous name.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Agreed.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Renamed the module and updated references to the module name in data and code. Thanks for the name suggestion, Pedro!

Also reported https://code.launchpad.net/bugs/1278204 and suggested a fix for the underlying problem.

160. By Stefan Rijnhart (Opener)

[RFR] Shorten module name as a workaround for lp:1287204

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Typo in bug number, that should be: https://code.launchpad.net/bugs/1287204

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Stefan,

I have tested the module and now I see no reason for the new menu I proposed, because it only changes default values. It doesn't remove combo-boxes, which is what I understand at the beginning.

It works perfectly.

Thanks for the contribution.

Regards.

review: Approve (code review and test)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

We thought about doing the same module - we are annoyed by this default behavior - and you did it! So nice ;-)

LGTM

Thanks

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_move_line_no_default_search'
2=== added file 'account_move_line_no_default_search/__init__.py'
3=== added file 'account_move_line_no_default_search/__openerp__.py'
4--- account_move_line_no_default_search/__openerp__.py 1970-01-01 00:00:00 +0000
5+++ account_move_line_no_default_search/__openerp__.py 2014-03-03 15:17:47 +0000
6@@ -0,0 +1,48 @@
7+# -*- coding: utf-8 -*-
8+##############################################################################
9+#
10+# OpenERP, Open Source Management Solution
11+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+{
28+ "name" : "Move line search view - disable defaults for period and journal",
29+ "version" : "0.1",
30+ "author" : "Therp BV",
31+ "category": 'Accounting & Finance',
32+ 'description': """
33+OpenERP 7.0 implements a custom javascript search view for move lines. This
34+search view shows dropdowns for period and journal. By default, these are
35+set to the default journal and (current) period.
36+
37+This module leaves the search view extension for move lines intact, but
38+disables the default search values for the dropdowns so that you do not
39+have to disable these before entering your own search queries.
40+
41+.. image:: /account_move_line_no_default_search/static/src/img/move_line_search_view.png
42+
43+ """,
44+ 'website': 'http://therp.nl',
45+ 'depends' : [
46+ 'account',
47+ ],
48+ 'js': [
49+ 'static/src/js/move_line_search_view.js',
50+ ],
51+ 'images': [
52+ 'static/src/img/move_line_search_view.png',
53+ ],
54+}
55
56=== added directory 'account_move_line_no_default_search/static'
57=== added directory 'account_move_line_no_default_search/static/src'
58=== added directory 'account_move_line_no_default_search/static/src/img'
59=== added file 'account_move_line_no_default_search/static/src/img/icon.png'
60Binary files account_move_line_no_default_search/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_move_line_no_default_search/static/src/img/icon.png 2014-03-03 15:17:47 +0000 differ
61=== added file 'account_move_line_no_default_search/static/src/img/move_line_search_view.png'
62Binary files account_move_line_no_default_search/static/src/img/move_line_search_view.png 1970-01-01 00:00:00 +0000 and account_move_line_no_default_search/static/src/img/move_line_search_view.png 2014-03-03 15:17:47 +0000 differ
63=== added directory 'account_move_line_no_default_search/static/src/js'
64=== added file 'account_move_line_no_default_search/static/src/js/move_line_search_view.js'
65--- account_move_line_no_default_search/static/src/js/move_line_search_view.js 1970-01-01 00:00:00 +0000
66+++ account_move_line_no_default_search/static/src/js/move_line_search_view.js 2014-03-03 15:17:47 +0000
67@@ -0,0 +1,38 @@
68+/*
69+
70+ Copyright (C) 2013 Therp BV
71+ License: GNU AFFERO GENERAL PUBLIC LICENSE
72+ Version 3 or any later version
73+
74+ Disable default search on the default journal and period
75+ in the javascript search extension on move lines in
76+ openobject-addons/account/static/src/js/account_move_line_quickadd.js
77+*/
78+openerp.account_move_line_no_default_search = function (instance) {
79+ instance.web.account.QuickAddListView.include({
80+ start: function() {
81+ /*
82+ Set a hook to be honoured in our override of do_search()
83+ so as to prevent a default search on account move lines
84+ on the default period and journal.
85+ */
86+ this.block_default_search = true;
87+ return this._super.apply(this, arguments);
88+ },
89+
90+ do_search: function(domain, context, group_by) {
91+ /*
92+ Check for a flag to block default search
93+ and reset default values when it has been found,
94+ then reset the blocking flag.
95+ */
96+ if (this.block_default_search === true) {
97+ this.current_journal = null;
98+ this.current_period = null;
99+ this.block_default_search = false;
100+ }
101+ return this._super.apply(this, arguments);
102+ },
103+ });
104+};
105+
106\ No newline at end of file

Subscribers

People subscribed via source and target branches