Merge lp:~alejandrosantana/account-financial-tools/7.0-account-financial_tools--add--account_account_extended_search into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Pedro Manuel Baeza
Status: Work in progress
Proposed branch: lp:~alejandrosantana/account-financial-tools/7.0-account-financial_tools--add--account_account_extended_search
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 173 lines (+152/-0)
3 files modified
account_account_extended_search/__init__.py (+28/-0)
account_account_extended_search/__openerp__.py (+62/-0)
account_account_extended_search/account.py (+62/-0)
To merge this branch: bzr merge lp:~alejandrosantana/account-financial-tools/7.0-account-financial_tools--add--account_account_extended_search
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp Needs Fixing
Alejandro Santana (community) Needs Information
Stefan Rijnhart (Opener) Needs Information
Frederic Clementi - Camptocamp (community) Needs Information
Guewen Baconnier @ Camptocamp Needs Information
Graeme Gellatly (code review, no test) Approve
Pedro Manuel Baeza Approve
Review via email: mp+200092@code.launchpad.net

Description of the change

New module account_account_extended_search that allows to search any account with the character '.' inside as a wildcard.

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

Alejandro, please fix these things:

- Remove all the chart template stuff, that doesn't belong to this module.
- Change module name and description in manifest file accordingly.
- Restart the version numbering to 1.0.
- Remove comment about templates at the beginning in account.py.
- Change the icon to one that is not duplicated from standard ones. You can make a slightly variation, for example.
- Remove 'l10n_es' as dependency and add 'account'.
- Remove template views modifications.
- Rebuild translations.

Thank you very much.

Regards.

review: Needs Fixing (code review)
Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

So, in a nutshell, keep only the search via dot wildcard functionality, isn't it?

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

Yeah, that is!

137. By Alejandro Santana

[FIX] account_account_extetnded_search: clean unnecesary features, change icon.

Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

Changes made.
Yet I am not able to load module description translation after installing it.

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

Hi, Alejandro, there is still some stuff from the previous functionality: you can safely remove account_account_view.xml file, because it contains only reference to chart_template_id stuff and it's not referenced in manifest file.

As I told you in another message, translations are always handle on base module, so you are not going to be able to load any translation from the module itself. You can remove also i18n directory then.

Regards.

review: Needs Fixing
138. By Alejandro Santana

[FIX] Remove unnecesary files.

Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

Done.

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

Perfect! Thank you very much.

Regards

review: Approve
Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

Always welcome.

Alejandro Santana
<email address hidden>
~
ANUBÍA, soluciones en la nube, S.L.
www.anubia.es
 El 30/12/2013 15:37, "Pedro Manuel Baeza" <email address hidden> escribió:

> Review: Approve
>
> Perfect! Thank you very much.
>
> Regards
> --
>
> https://code.launchpad.net/~alejandrosantana/account-financial-tools/7.0-account-financial_tools--add--account_account_extended_search/+merge/200092
> You are the owner of
> lp:~alejandrosantana/account-financial-tools/7.0-account-financial_tools--add--account_account_extended_search.
>

Revision history for this message
Graeme Gellatly (gdgellatly) wrote :

LGTM!

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

Is it something only used in spain? Do you have an idea?
(If yes wouldn't it be better to put it in the Spanish localization?)

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

Hi, Guewen, it is used in Spain, but it's a generic tool useful for anyone that has complex account charts (some countries on South America, and so on).

Regards.

Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

Hello, I find this features really great but why using a . instead of a * for example which is more commonly used.

It is also a shame for us in switzerland since the structure of ou chart can be something like:

10.0
  101.0
    1000
    1001
  102.0

...So if I am looking for a account of the account 101.0 the result will be 101.0, 1000, 1001.
Am I correct ?

Thanks

review: Needs Information
Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

Hello. It comes from the usage in Spain, where accounts in chart have no dots (.) and probably 99% of accountants expect and demand the dot as a wildcard.
I am not sure about the current behaviour on accounts with dots, like Swiss one you comment. I will give it a try.

One thought: Maybe the wildcard used could be selected or specified somewhere ('.', '*', other?). That way would fit in both scenarios (and maybe others).

Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

@Frederic
OK, tested and also took a look at the code again. Right now, when using a dot in the search it serves as a wildcard for zeroes.
So in your example if you search 101.0, you would find: 101.0, 1010, 10100000, 101(any number of zeroes or the dot itself)0, but not 1001.
Also, if you search for 102.1, it will not find 102.01

Its original goal is to be used for accounts like 47200001, 47200002... (fixed digists), so you could search 472.1 and find 47200001, typing no zeroes.

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

Code looks good to me, and it's working fine. It looks to me like a very specific use case, which also does not apply to Dutch accounting habits but it may be broader than just Spanish (you never know, right?) so I think having the module here is fine.

What bothers me a little is the module name. Yes, it extends the search but it does so in a very specific way. Would you consider to change the name to something like "account_account_wildcard_zero_search"?

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

Guewen and Frederic, do the responses satisfy your information requests? Also, anyone else has an opinion about the name of the module?

Revision history for this message
Alejandro Santana (alejandrosantana) wrote :

Maybe the wildcard could be made configurable.
This way, Spanish accountants could use a dot (.), as they are so used to. And in other countries it could be configured to be other character, like asterisk (*) or any other.
Also, the pattern to search could be configurable too, or maybe modified to accept finding dots. Right now it searches for zeroes only. Not sure what to allow, though. What would be the needs in other countries?

What do you think? That way its case of use broadens to almost? every country.

review: Needs Information
Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

Personally, I have been practicing accounting in UK, France and Switzerland and I have never used a search based on dots. So +1 for something more configurable (hence, more generic and potentially used by more people).

If not possible, like Stefan said, we should give a more specific name (like maybe : account_wildcard_dot_search)

Frederic

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

I set as need fixing after Frederic's comment

review: Needs Fixing
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

setting the MP as work in progress. Please set it back to "needs review" when requested changes are made.

Unmerged revisions

138. By Alejandro Santana

[FIX] Remove unnecesary files.

137. By Alejandro Santana

[FIX] account_account_extetnded_search: clean unnecesary features, change icon.

136. By Alejandro Santana

[ADD] Adds account_account_extended_search providing some tools for Spanish accountants and maybe others.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_account_extended_search'
2=== added file 'account_account_extended_search/__init__.py'
3--- account_account_extended_search/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_account_extended_search/__init__.py 2013-12-30 13:16:52 +0000
5@@ -0,0 +1,28 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+#
11+# Copyright (c) All rights reserved:
12+# (c) 2008-2010 Zikzakmedia S.L. (http://zikzakmedia.com)
13+# Jordi Esteve <jesteve@zikzakmedia.com>
14+# (c) 2013 Joan M. Grande <totaler@gmail.com>
15+# (c) 2013 Anubía, soluciones en la nube,SL (http://www.anubia.es)
16+# Alejandro Santana <alejandrosantana@anubia.es>
17+#
18+# This program is free software: you can redistribute it and/or modify
19+# it under the terms of the GNU Affero General Public License as
20+# published by the Free Software Foundation, either version 3 of the
21+# License, or (at your option) any later version.
22+#
23+# This program is distributed in the hope that it will be useful,
24+# but WITHOUT ANY WARRANTY; without even the implied warranty of
25+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+# GNU Affero General Public License for more details.
27+#
28+# You should have received a copy of the GNU Affero General Public License
29+# along with this program. If not, see <http://www.gnu.org/licenses/>.
30+#
31+##############################################################################
32+
33+from . import account
34
35=== added file 'account_account_extended_search/__openerp__.py'
36--- account_account_extended_search/__openerp__.py 1970-01-01 00:00:00 +0000
37+++ account_account_extended_search/__openerp__.py 2013-12-30 13:16:52 +0000
38@@ -0,0 +1,62 @@
39+# -*- coding: utf-8 -*-
40+##############################################################################
41+#
42+# OpenERP, Open Source Management Solution
43+#
44+# Copyright (c) All rights reserved:
45+# (c) 2008-2010 Zikzakmedia S.L. (http://zikzakmedia.com)
46+# Jordi Esteve <jesteve@zikzakmedia.com>
47+# (c) 2013 Joan M. Grande <totaler@gmail.com>
48+# (c) 2013 Anubía, soluciones en la nube,SL (http://www.anubia.es)
49+# Alejandro Santana <alejandrosantana@anubia.es>
50+#
51+# This program is free software: you can redistribute it and/or modify
52+# it under the terms of the GNU Affero General Public License as
53+# published by the Free Software Foundation, either version 3 of the
54+# License, or (at your option) any later version.
55+#
56+# This program is distributed in the hope that it will be useful,
57+# but WITHOUT ANY WARRANTY; without even the implied warranty of
58+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59+# GNU Affero General Public License for more details.
60+#
61+# You should have received a copy of the GNU Affero General Public License
62+# along with this program. If not, see <http://www.gnu.org/licenses/>.
63+#
64+##############################################################################
65+
66+{
67+ "name": "Extended account search using wildcard",
68+ "version": "1.0",
69+ "category": "Accounting/Tools",
70+ "description": """
71+Account search improvement for Spanish accountants:
72+===================================================
73+
74+ * Improves the search of accounts using a dot wildcard to fill in
75+ the zeroes within the account number, as it is the de facto standard
76+ search in Spain (e.g. type 43.27 to search account 43000027).
77+
78+""",
79+ "complexity": "easy",
80+ "license": "AGPL-3",
81+ "author": "Spanish Localization Team",
82+ "website": "https://launchpad.net/openerp-spain",
83+ "contributors": [
84+ "Jordi Esteve <jesteve@zikzakmedia.com>",
85+ "Joan M. Grande <totaler@gmail.com>",
86+ "Alejandro Santana <alejandrosantana@anubia.es>",
87+ ],
88+ "depends": [
89+ "account",
90+ ],
91+ "data": [],
92+ "demo": [],
93+ "test": [],
94+ "images": [],
95+ "active": False,
96+ "installable": True,
97+ "application": False,
98+ "auto_install": False,
99+ "certificate": "",
100+}
101
102=== added file 'account_account_extended_search/account.py'
103--- account_account_extended_search/account.py 1970-01-01 00:00:00 +0000
104+++ account_account_extended_search/account.py 2013-12-30 13:16:52 +0000
105@@ -0,0 +1,62 @@
106+# -*- coding: utf-8 -*-
107+##############################################################################
108+#
109+# OpenERP, Open Source Management Solution
110+#
111+# Copyright (c) All rights reserved:
112+# (c) 2008-2010 Zikzakmedia S.L. (http://zikzakmedia.com)
113+# Jordi Esteve <jesteve@zikzakmedia.com>
114+# (c) 2010-2010 NaN-Tic (http://www.nan-tic.com)
115+# Albert Cervera
116+# (c) 2013 Joan M. Grande <totaler@gmail.com>
117+# (c) 2013 Anubía, soluciones en la nube,SL (http://www.anubia.es)
118+# Alejandro Santana <alejandrosantana@anubia.es>
119+#
120+# This program is free software: you can redistribute it and/or modify
121+# it under the terms of the GNU Affero General Public License as
122+# published by the Free Software Foundation, either version 3 of the
123+# License, or (at your option) any later version.
124+#
125+# This program is distributed in the hope that it will be useful,
126+# but WITHOUT ANY WARRANTY; without even the implied warranty of
127+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128+# GNU Affero General Public License for more details.
129+#
130+# You should have received a copy of the GNU Affero General Public License
131+# along with this program. If not, see <http://www.gnu.org/licenses/>.
132+#
133+##############################################################################
134+
135+from openerp.osv import fields, orm
136+
137+
138+class account_account(orm.Model):
139+ _inherit = "account.account"
140+
141+ def search(self, cr, uid, args, offset=0, limit=None, order=None,
142+ context=None, count=False):
143+ """Improves the search of accounts using a dot wildcard to fill in
144+ the zeroes within the account number, as it is the de facto standard
145+ search in Spain. (e.g. type 43.27 to search account 43000027)."""
146+ args = args[:]
147+ pos = 0
148+ while pos < len(args):
149+ if (args[pos][0] == 'code' and
150+ args[pos][1] in ('like', 'ilike', '=like') and
151+ args[pos][2]):
152+ query = args[pos][2].replace('%', '')
153+ if '.' in query:
154+ query = query.partition('.')
155+ cr.execute("""SELECT id FROM account_account
156+ WHERE type <> 'view'
157+ AND code ~ ('^' || %s || '0+' || %s || '$')""",
158+ (query[0], query[2]))
159+ ids = [x[0] for x in cr.fetchall()]
160+ if ids:
161+ args[pos] = ('id', 'in', ids)
162+ pos += 1
163+ return super(account_account, self).search(cr, uid, args,
164+ offset, limit, order,
165+ context, count)
166+
167+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
168
169=== added directory 'account_account_extended_search/static'
170=== added directory 'account_account_extended_search/static/src'
171=== added directory 'account_account_extended_search/static/src/img'
172=== added file 'account_account_extended_search/static/src/img/icon.png'
173Binary files account_account_extended_search/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_account_extended_search/static/src/img/icon.png 2013-12-30 13:16:52 +0000 differ

Subscribers

People subscribed via source and target branches