From 8cccfe3201e863171b5e399f5debbe11369860d4 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Sat, 20 Dec 2014 22:02:37 +0100 Subject: [PATCH 1/7] V8 port account_move_line_search_extension --- .../__init__.py | 23 +++++ .../__openerp__.py | 55 ++++++++++ account_move_line_search_extension/account.py | 43 ++++++++ .../account_view.xml | 22 ++++ .../account_move_line_search_extension.css | 5 + .../static/src/img/icon.png | Bin 0 -> 19742 bytes .../js/account_move_line_search_extension.js | 94 ++++++++++++++++++ .../account_move_line_search_extension.xml | 29 ++++++ .../views/account.xml | 13 +++ 9 files changed, 284 insertions(+) create mode 100644 account_move_line_search_extension/__init__.py create mode 100644 account_move_line_search_extension/__openerp__.py create mode 100644 account_move_line_search_extension/account.py create mode 100644 account_move_line_search_extension/account_view.xml create mode 100644 account_move_line_search_extension/static/src/css/account_move_line_search_extension.css create mode 100644 account_move_line_search_extension/static/src/img/icon.png create mode 100644 account_move_line_search_extension/static/src/js/account_move_line_search_extension.js create mode 100644 account_move_line_search_extension/static/src/xml/account_move_line_search_extension.xml create mode 100644 account_move_line_search_extension/views/account.xml diff --git a/account_move_line_search_extension/__init__.py b/account_move_line_search_extension/__init__.py new file mode 100644 index 000000000..87623927b --- /dev/null +++ b/account_move_line_search_extension/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# +# Copyright (c) 2013-14 Noviat nv/sa (www.noviat.com). All rights reserved. +# +# 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 . +# +############################################################################## + +from . import account diff --git a/account_move_line_search_extension/__openerp__.py b/account_move_line_search_extension/__openerp__.py new file mode 100644 index 000000000..92e278415 --- /dev/null +++ b/account_move_line_search_extension/__openerp__.py @@ -0,0 +1,55 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# +# Copyright (c) 2013-14 Noviat nv/sa (www.noviat.com). All rights reserved. +# +# 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 . +# +############################################################################## + +{ + 'name': 'Journal Items Search Extension', + 'version': '0.2', + 'license': 'AGPL-3', + 'author': 'Noviat', + 'category': 'Generic Modules', + 'description': """ +Journal Items Search Extension +============================== + +This module adds the 'Journal Items Search All' menu entry. + +This menu entry adds a number of search fields on top of the List View rows. +These fields can be used in combination with the Search window. + +The purpose of this view is to offer a fast drill down capability +when searching through large number of accounting entries. + +The drill down is facilitated further by opening the Form View when clicking on +the sought-after entry. +This allows an intuitive click-through to the related accounting documents +such as the originating Bank Statement, Invoice, Asset, ... + + """, + 'depends': ['account'], + 'data': [ + 'account_view.xml', + 'views/account.xml', + ], + 'qweb': [ + 'static/src/xml/account_move_line_search_extension.xml', + ], +} diff --git a/account_move_line_search_extension/account.py b/account_move_line_search_extension/account.py new file mode 100644 index 000000000..85d8f0d59 --- /dev/null +++ b/account_move_line_search_extension/account.py @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# +# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. +# +# 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 . +# +############################################################################## + +from openerp.osv import orm +from lxml import etree + + +class account_move_line(orm.Model): + _inherit = 'account.move.line' + + def fields_view_get(self, cr, uid, view_id=None, view_type='form', + context=None, toolbar=False, submenu=False): + res = super(account_move_line, self).fields_view_get( + cr, uid, view_id=view_id, view_type=view_type, + context=context, toolbar=toolbar, submenu=False) + if context and 'account_move_line_search_extension' in context \ + and view_type == 'tree': + doc = etree.XML(res['arch']) + nodes = doc.xpath("/tree") + for node in nodes: + if 'editable' in node.attrib: + del node.attrib['editable'] + res['arch'] = etree.tostring(doc) + return res diff --git a/account_move_line_search_extension/account_view.xml b/account_move_line_search_extension/account_view.xml new file mode 100644 index 000000000..5318aa7dd --- /dev/null +++ b/account_move_line_search_extension/account_view.xml @@ -0,0 +1,22 @@ + + + + + + {'account_move_line_search_extension':1} + Journal Items Search All + account.move.line + + account_move_line_search_extension,form + + + + + diff --git a/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css b/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css new file mode 100644 index 000000000..812421790 --- /dev/null +++ b/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css @@ -0,0 +1,5 @@ +.openerp .oe_form_char_section { + position: relative; + display: inline-block; +} + diff --git a/account_move_line_search_extension/static/src/img/icon.png b/account_move_line_search_extension/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..214166a26c853ca359400678399b332117e846ab GIT binary patch literal 19742 zcmWifV{{}75QT$HveCxc*tTuk$%Y%-+1O4dwr$(CZQHirydOP%PM^V#>8g9{tJ`4; za^mnXzhOW?K;R`MM3jK%-T#lDV8GYfSy5Wx3Cc-QRupOz4jUPtVt7`v0eA`8PD0ZW z1O(6Z{{wWq92_5b@rS9PtRV1H(XbzXAwWQ6DkVh(Rb1CDy`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f08vu6(gdhFOS00YbwSd`3?2RH*I5dQ=_qy5AKoWXfI zRvBU<-J-JOvjwbT!N{qt>P0GX^Awe3iUUf?-Me=;G&Hofw$iMV+o9BXtnvU09~u{< zPO`Z4G&3>kx5l;B5Bn*#v_s&8dJAsTPZ#>Y`G2u{T7%IZKYskkkt29F{IjK{1(T+su~}C_sK&MToocnP zVtYAgW@6MyHvoU(7~uj)NSNwCWKU1ep+kqbq@liQlL9F8IPp$R}(;4f5c;1$2BsjZiuEY)`7 zTC0|)V`wh*ttlAIGCjAn+fwg-hUsd=o6P*ca()5B{X>;QAmvPFM&%OtD(&@HqR-b#Ku2r+fY@ZRDwSva9HbH$7+nPDJ)e*P%?@KuHJ{6C8(@2^T`iQ;AVRP-2vk9u^KtZ%=_GC0lZg{E#M* zsw`@zPAxaANEH)jpn8&75{n=vRFNB8q@bs)mo}3`C;wTQna|E0vfZ{pKa@0g)TMSt z7s<7FvQM1nLXZ4P#)-04gv$H!eUug&KaaD88%y<64Upli;^b2`0m&novI0a{Q{&c@ zIUuJ*`D~*q39?8|i6JQ)Ef{6+vXtg39Lb6Emz3m#Cdfw%$$DwXYl@a&(Ij*wuL)zb z?0*Co!rKOs6{9NU8#(U@qng4>)svpF z=^Y78saeVg%k3qq(yjVO`8VH1TE%F2$pRpCKqX63V=q;HDP2p%uFA!1SCu9LP;Fd& zRE4QzpPDkyc1JX|bj(tgGBkGFoZodpu({G3&Yf5f<#K+efPytu)HVsG;m2QbRAKC1k;_ zWvhurX`HxGuNCl*I+0Vnsk&mMGE0jIFMq=L)cpHYsY1vii|H%W@@yT?*yQ#qAGN*D z#Gxtaz1F$2Xaef&u~vs+fR1!xtl z Date: Mon, 9 Mar 2015 10:14:26 +0100 Subject: [PATCH 3/7] add analytic + fix tree/form view switch --- .../__init__.py | 3 +- .../__openerp__.py | 4 +- account_move_line_search_extension/account.py | 23 ++++++- .../account_view.xml | 11 ++++ .../ir_actions.py | 62 ++++++++++++++++++ .../static/{src/img => description}/icon.png | Bin .../account_move_line_search_extension.css | 5 ++ .../js/account_move_line_search_extension.js | 32 +++++++-- .../account_move_line_search_extension.xml | 30 +++++---- 9 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 account_move_line_search_extension/ir_actions.py rename account_move_line_search_extension/static/{src/img => description}/icon.png (100%) diff --git a/account_move_line_search_extension/__init__.py b/account_move_line_search_extension/__init__.py index 87623927b..d8798c3a5 100644 --- a/account_move_line_search_extension/__init__.py +++ b/account_move_line_search_extension/__init__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013-14 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,3 +21,4 @@ ############################################################################## from . import account +from . import ir_actions diff --git a/account_move_line_search_extension/__openerp__.py b/account_move_line_search_extension/__openerp__.py index 51a4f13dc..e09f0896b 100644 --- a/account_move_line_search_extension/__openerp__.py +++ b/account_move_line_search_extension/__openerp__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013-14 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,7 +22,7 @@ { 'name': 'Journal Items Search Extension', - 'version': '0.2', + 'version': '0.4', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', diff --git a/account_move_line_search_extension/account.py b/account_move_line_search_extension/account.py index 85d8f0d59..58a638d72 100644 --- a/account_move_line_search_extension/account.py +++ b/account_move_line_search_extension/account.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,6 +22,8 @@ from openerp.osv import orm from lxml import etree +import logging +_logger = logging.getLogger(__name__) class account_move_line(orm.Model): @@ -41,3 +43,22 @@ class account_move_line(orm.Model): del node.attrib['editable'] res['arch'] = etree.tostring(doc) return res + + def search(self, cr, uid, args, offset=0, limit=None, order=None, + context=None, count=False): + if context and 'account_move_line_search_extension' in context: + ana_obj = self.pool['account.analytic.account'] + for arg in args: + if arg[0] == 'analytic_account_id': + ana_dom = ['|', + ('name', 'ilike', arg[2]), + ('code', 'ilike', arg[2])] + ana_ids = ana_obj.search( + cr, uid, ana_dom, context=context) + ana_ids = ana_obj.search( + cr, uid, [('id', 'child_of', ana_ids)]) + arg[2] = ana_ids + break + return super(account_move_line, self).search( + cr, uid, args, offset=offset, limit=limit, order=order, + context=context, count=count) diff --git a/account_move_line_search_extension/account_view.xml b/account_move_line_search_extension/account_view.xml index 5318aa7dd..560a6e814 100644 --- a/account_move_line_search_extension/account_view.xml +++ b/account_move_line_search_extension/account_view.xml @@ -18,5 +18,16 @@ groups="account.group_account_user" /> + + amlse.view.move.line.tree + account.move.line + + + + False + + + + diff --git a/account_move_line_search_extension/ir_actions.py b/account_move_line_search_extension/ir_actions.py new file mode 100644 index 000000000..1fd5246cd --- /dev/null +++ b/account_move_line_search_extension/ir_actions.py @@ -0,0 +1,62 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# +# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com). +# +# 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 . +# +############################################################################## + +from openerp import models +import logging +_logger = logging.getLogger(__name__) + + +class ir_actions_act_window(models.Model): + _inherit = 'ir.actions.act_window' + + def __init__(self, pool, cr): + module = 'account_move_line_search_extension' + xml_id = 'action_account_move_line_search_extension' + cr.execute( + "SELECT res_id from ir_model_data " + "WHERE model = 'ir.actions.act_window' " + "AND module = %s AND name = %s ", + (module, xml_id)) + res = cr.fetchone() + self._amlse_act_id = res[0] + super(ir_actions_act_window, self).__init__(pool, cr) + + def _amlse_add_groups(self, cr, uid, context): + groups = {} + if self.pool['res.users'].has_group( + cr, uid, 'analytic.group_analytic_accounting'): + groups['group_analytic'] = 1 + return groups + + def read(self, cr, uid, ids, fields=None, + context=None, load='_classic_read'): + if not context: + context = {} + res = super(ir_actions_act_window, self).read( + cr, uid, ids, fields=fields, context=context, load=load) + if ids == [self._amlse_act_id]: + amlse_act = res[0] + if amlse_act.get('context'): + act_ctx = eval(amlse_act['context']) + act_ctx.update(self._amlse_add_groups(cr, uid, context)) + amlse_act['context'] = str(act_ctx) + return res diff --git a/account_move_line_search_extension/static/src/img/icon.png b/account_move_line_search_extension/static/description/icon.png similarity index 100% rename from account_move_line_search_extension/static/src/img/icon.png rename to account_move_line_search_extension/static/description/icon.png diff --git a/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css b/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css index 812421790..9945b1fce 100644 --- a/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css +++ b/account_move_line_search_extension/static/src/css/account_move_line_search_extension.css @@ -1,3 +1,8 @@ +.openerp .oe_vm_switch_account_move_line_search_extension:after { + padding: 2px; + content: "i"; +} + .openerp .oe_form_char_section { position: relative; display: inline-block; diff --git a/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js b/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js index 8f5b2f80a..1e450c4c0 100644 --- a/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js +++ b/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js @@ -1,6 +1,4 @@ openerp.account_move_line_search_extension = function (instance) { - var _t = instance.web._t, - _lt = instance.web._lt; var QWeb = instance.web.qweb; instance.account_move_line_search_extension = {}; @@ -9,24 +7,31 @@ openerp.account_move_line_search_extension = function (instance) { instance.account_move_line_search_extension.ListSearchView = instance.web.ListView.extend({ init: function() { + var self = this; this._super.apply(this, arguments); this.journals = []; this.current_account = null; + this.current_analytic_account = null; this.current_partner = null; this.current_journal = null; this.current_period = null; this.options.addable = false; + this.set_user_groups(); }, - start:function(){ + start: function(){ var tmp = this._super.apply(this, arguments); var self = this; - this.$el.parent().prepend(QWeb.render('AccountMoveLineSearchExtension', {widget: this})); + this.$el.parent().prepend(QWeb.render('AccountMoveLineSearchExtension', self.groups_dict)); this.$el.parent().find('.oe_account_select_account').change(function() { self.current_account = this.value === '' ? null : this.value; self.do_search(self.last_domain, self.last_context, self.last_group_by); }); + this.$el.parent().find('.oe_account_select_analytic_account').change(function() { + self.current_analytic_account = this.value === '' ? null : this.value; + self.do_search(self.last_domain, self.last_context, self.last_group_by); + }); this.$el.parent().find('.oe_account_select_partner').change(function() { self.current_partner = this.value === '' ? null : this.value; self.do_search(self.last_domain, self.last_context, self.last_group_by); @@ -42,12 +47,14 @@ openerp.account_move_line_search_extension = function (instance) { }); this.on('edit:after', this, function () { self.$el.parent().find('.oe_account_select_account').attr('disabled', 'disabled'); + self.$el.parent().find('.oe_account_select_analytic_account').attr('disabled', 'disabled'); self.$el.parent().find('.oe_account_select_partner').attr('disabled', 'disabled'); self.$el.parent().find('.oe_account_select_journal').attr('disabled', 'disabled'); self.$el.parent().find('.oe_account_select_period').attr('disabled', 'disabled'); }); this.on('save:after cancel:after', this, function () { self.$el.parent().find('.oe_account_select_account').removeAttr('disabled'); + self.$el.parent().find('.oe_account_select_analytic_account').removeAttr('disabled'); self.$el.parent().find('.oe_account_select_partner').removeAttr('disabled'); self.$el.parent().find('.oe_account_select_journal').removeAttr('disabled'); self.$el.parent().find('.oe_account_select_period').removeAttr('disabled'); @@ -55,6 +62,22 @@ openerp.account_move_line_search_extension = function (instance) { return tmp; }, + set_user_groups: function() { + var self = this; + var result = {}; + var action_context = this.dataset.get_context().__contexts[1]; + _.each(action_context, function(v,k) { + //console.log('init, k=', k, 'v=', v); + if (k[v] && (k.slice(0, 6) === "group_")) { + result[k] = true; + } + else { + result[k] = false; + }; + }); + self.groups_dict = result; + }, + do_search: function(domain, context, group_by) { var self = this; this.last_domain = domain; @@ -83,6 +106,7 @@ openerp.account_move_line_search_extension = function (instance) { var self = this; var domain = []; if (self.current_account) domain.push(['account_id.code', 'ilike', self.current_account]); + if (self.current_analytic_account) domain.push(['analytic_account_id', 'in', self.current_analytic_account]); //cf. def search if (self.current_partner) domain.push(['partner_id.name', 'ilike', self.current_partner],'|',['partner_id.parent_id','=',false],['partner_id.is_company','=',true]); if (self.current_journal) domain.push(['journal_id', '=', self.current_journal]); if (self.current_period) domain.push('|',['period_id.code', 'ilike', self.current_period],['period_id.name', 'ilike', self.current_period]); diff --git a/account_move_line_search_extension/static/src/xml/account_move_line_search_extension.xml b/account_move_line_search_extension/static/src/xml/account_move_line_search_extension.xml index a22e1c7a8..09ce57a6c 100644 --- a/account_move_line_search_extension/static/src/xml/account_move_line_search_extension.xml +++ b/account_move_line_search_extension/static/src/xml/account_move_line_search_extension.xml @@ -1,27 +1,29 @@ - +
-

Account :

- - -
+

Account :

+ +
+ +
+

Analytic Account :

+ +
+
-

Partner :

- - +

Partner :

+
-

Journal :

- +

Journal :

+ - +

Period :

+
From bf13bb032c51e8675e6cc7bfa9701a14f8a6acaa Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Wed, 11 Mar 2015 15:37:34 +0100 Subject: [PATCH 4/7] bugfix --- account_move_line_search_extension/ir_actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_move_line_search_extension/ir_actions.py b/account_move_line_search_extension/ir_actions.py index 1fd5246cd..7daa639d0 100644 --- a/account_move_line_search_extension/ir_actions.py +++ b/account_move_line_search_extension/ir_actions.py @@ -37,7 +37,7 @@ class ir_actions_act_window(models.Model): "AND module = %s AND name = %s ", (module, xml_id)) res = cr.fetchone() - self._amlse_act_id = res[0] + self._amlse_act_id = res and res[0] super(ir_actions_act_window, self).__init__(pool, cr) def _amlse_add_groups(self, cr, uid, context): From 46d2c5a06c07671e4c0c10c004080ca1bb93a503 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Tue, 28 Apr 2015 12:28:37 +0200 Subject: [PATCH 5/7] update 80 account_move_line_search_extension --- account_move_line_search_extension/README.rst | 24 +++++++++++ .../__init__.py | 1 + .../__openerp__.py | 2 +- account_move_line_search_extension/account.py | 6 +-- .../ir_actions.py | 2 - .../res_partner.py | 41 +++++++++++++++++++ .../js/account_move_line_search_extension.js | 34 +++++++-------- 7 files changed, 83 insertions(+), 27 deletions(-) create mode 100644 account_move_line_search_extension/res_partner.py diff --git a/account_move_line_search_extension/README.rst b/account_move_line_search_extension/README.rst index 1a3a2ee9c..de57bebfd 100644 --- a/account_move_line_search_extension/README.rst +++ b/account_move_line_search_extension/README.rst @@ -1,3 +1,6 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License + Journal Items Search Extension ============================== @@ -13,3 +16,24 @@ The drill down is facilitated further by opening the Form View when clicking on the sought-after entry. This allows an intuitive click-through to the related accounting documents such as the originating Bank Statement, Invoice, Asset, ... + +Credits +======= + +Author +------ +* Luc De Meyer, Noviat + +Maintainer +---------- +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/account_move_line_search_extension/__init__.py b/account_move_line_search_extension/__init__.py index d8798c3a5..edb26d42a 100644 --- a/account_move_line_search_extension/__init__.py +++ b/account_move_line_search_extension/__init__.py @@ -21,4 +21,5 @@ ############################################################################## from . import account +from . import res_partner from . import ir_actions diff --git a/account_move_line_search_extension/__openerp__.py b/account_move_line_search_extension/__openerp__.py index e09f0896b..89de8a22f 100644 --- a/account_move_line_search_extension/__openerp__.py +++ b/account_move_line_search_extension/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Journal Items Search Extension', - 'version': '0.4', + 'version': '0.5', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', diff --git a/account_move_line_search_extension/account.py b/account_move_line_search_extension/account.py index 58a638d72..a21db3b7e 100644 --- a/account_move_line_search_extension/account.py +++ b/account_move_line_search_extension/account.py @@ -20,13 +20,11 @@ # ############################################################################## -from openerp.osv import orm +from openerp import models from lxml import etree -import logging -_logger = logging.getLogger(__name__) -class account_move_line(orm.Model): +class account_move_line(models.Model): _inherit = 'account.move.line' def fields_view_get(self, cr, uid, view_id=None, view_type='form', diff --git a/account_move_line_search_extension/ir_actions.py b/account_move_line_search_extension/ir_actions.py index 7daa639d0..df2e04778 100644 --- a/account_move_line_search_extension/ir_actions.py +++ b/account_move_line_search_extension/ir_actions.py @@ -21,8 +21,6 @@ ############################################################################## from openerp import models -import logging -_logger = logging.getLogger(__name__) class ir_actions_act_window(models.Model): diff --git a/account_move_line_search_extension/res_partner.py b/account_move_line_search_extension/res_partner.py new file mode 100644 index 000000000..1746d2a4d --- /dev/null +++ b/account_move_line_search_extension/res_partner.py @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# +# Copyright (c) 2015 Noviat nv/sa (www.noviat.com). +# +# 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 . +# +############################################################################## + +from openerp import models + + +class res_partner(models.Model): + _inherit = 'res.partner' + + def search(self, cr, uid, args, + offset=0, limit=None, order=None, context=None, count=False): + if context and 'account_move_line_search_extension' in context: + args.extend( + ['|', + ('parent_id', '=', False), + ('is_company', '=', True), + '|', + ('active', '=', False), + ('active', '=', True)]) + return super(res_partner, self).search( + cr, uid, args, offset=offset, limit=limit, order=order, + context=context, count=count) diff --git a/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js b/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js index 1e450c4c0..effa8b0ec 100644 --- a/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js +++ b/account_move_line_search_extension/static/src/js/account_move_line_search_extension.js @@ -23,7 +23,12 @@ openerp.account_move_line_search_extension = function (instance) { var tmp = this._super.apply(this, arguments); var self = this; this.$el.parent().prepend(QWeb.render('AccountMoveLineSearchExtension', self.groups_dict)); + self.set_change_events(); + return tmp; + }, + set_change_events: function() { + var self = this; this.$el.parent().find('.oe_account_select_account').change(function() { self.current_account = this.value === '' ? null : this.value; self.do_search(self.last_domain, self.last_context, self.last_group_by); @@ -38,28 +43,12 @@ openerp.account_move_line_search_extension = function (instance) { }); this.$el.parent().find('.oe_account_select_journal').change(function() { self.current_journal = this.value === '' ? null : parseInt(this.value); - //console.log('start, oasj, self.current_journal=', self.current_journal, 'self.last_domain=', self.last_domain, 'self.last_context=', self.last_context, 'self.last_group_by=', self.last_group_by); self.do_search(self.last_domain, self.last_context, self.last_group_by); }); this.$el.parent().find('.oe_account_select_period').change(function() { self.current_period = this.value === '' ? null : this.value; self.do_search(self.last_domain, self.last_context, self.last_group_by); }); - this.on('edit:after', this, function () { - self.$el.parent().find('.oe_account_select_account').attr('disabled', 'disabled'); - self.$el.parent().find('.oe_account_select_analytic_account').attr('disabled', 'disabled'); - self.$el.parent().find('.oe_account_select_partner').attr('disabled', 'disabled'); - self.$el.parent().find('.oe_account_select_journal').attr('disabled', 'disabled'); - self.$el.parent().find('.oe_account_select_period').attr('disabled', 'disabled'); - }); - this.on('save:after cancel:after', this, function () { - self.$el.parent().find('.oe_account_select_account').removeAttr('disabled'); - self.$el.parent().find('.oe_account_select_analytic_account').removeAttr('disabled'); - self.$el.parent().find('.oe_account_select_partner').removeAttr('disabled'); - self.$el.parent().find('.oe_account_select_journal').removeAttr('disabled'); - self.$el.parent().find('.oe_account_select_period').removeAttr('disabled'); - }); - return tmp; }, set_user_groups: function() { @@ -67,7 +56,6 @@ openerp.account_move_line_search_extension = function (instance) { var result = {}; var action_context = this.dataset.get_context().__contexts[1]; _.each(action_context, function(v,k) { - //console.log('init, k=', k, 'v=', v); if (k[v] && (k.slice(0, 6) === "group_")) { result[k] = true; } @@ -102,15 +90,21 @@ openerp.account_move_line_search_extension = function (instance) { }); }, - search_by_selection: function() { + aml_search_domain: function() { var self = this; var domain = []; if (self.current_account) domain.push(['account_id.code', 'ilike', self.current_account]); if (self.current_analytic_account) domain.push(['analytic_account_id', 'in', self.current_analytic_account]); //cf. def search - if (self.current_partner) domain.push(['partner_id.name', 'ilike', self.current_partner],'|',['partner_id.parent_id','=',false],['partner_id.is_company','=',true]); + if (self.current_partner) domain.push(['partner_id.name', 'ilike', self.current_partner]); if (self.current_journal) domain.push(['journal_id', '=', self.current_journal]); if (self.current_period) domain.push('|',['period_id.code', 'ilike', self.current_period],['period_id.name', 'ilike', self.current_period]); - //_.each(domain, function(x) {console.log('search_by_journal_period, domain_part = ', x)}); + //_.each(domain, function(x) {console.log('amlse, aml_search_domain, domain_part = ', x)}); + return domain; + }, + + search_by_selection: function() { + var self = this; + var domain = self.aml_search_domain(); return self.old_search(new instance.web.CompoundDomain(self.last_domain, domain), self.last_context, self.last_group_by); }, From 12fa957847380aaed2a300a62f28310dc5d464c3 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Sun, 31 May 2015 17:43:24 +0200 Subject: [PATCH 6/7] improved support for analytics --- account_move_line_search_extension/__openerp__.py | 2 +- account_move_line_search_extension/account_view.xml | 13 +------------ account_move_line_search_extension/ir_actions.py | 9 +++++++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/account_move_line_search_extension/__openerp__.py b/account_move_line_search_extension/__openerp__.py index 89de8a22f..a2c14ac60 100644 --- a/account_move_line_search_extension/__openerp__.py +++ b/account_move_line_search_extension/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Journal Items Search Extension', - 'version': '0.5', + 'version': '0.6', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', diff --git a/account_move_line_search_extension/account_view.xml b/account_move_line_search_extension/account_view.xml index 560a6e814..a375d5bdb 100644 --- a/account_move_line_search_extension/account_view.xml +++ b/account_move_line_search_extension/account_view.xml @@ -3,7 +3,7 @@ - {'account_move_line_search_extension':1} + {'account_move_line_search_extension': 1, 'analytic_journal_id': 1} Journal Items Search All account.move.line @@ -18,16 +18,5 @@ groups="account.group_account_user" /> - - amlse.view.move.line.tree - account.move.line - - - - False - - - - diff --git a/account_move_line_search_extension/ir_actions.py b/account_move_line_search_extension/ir_actions.py index df2e04778..ef3a30fdd 100644 --- a/account_move_line_search_extension/ir_actions.py +++ b/account_move_line_search_extension/ir_actions.py @@ -26,7 +26,7 @@ from openerp import models class ir_actions_act_window(models.Model): _inherit = 'ir.actions.act_window' - def __init__(self, pool, cr): + def _get_amlse_act_id(self, cr): module = 'account_move_line_search_extension' xml_id = 'action_account_move_line_search_extension' cr.execute( @@ -35,7 +35,10 @@ class ir_actions_act_window(models.Model): "AND module = %s AND name = %s ", (module, xml_id)) res = cr.fetchone() - self._amlse_act_id = res and res[0] + return res and res[0] + + def __init__(self, pool, cr): + self._amlse_act_id = self._get_amlse_act_id(cr) super(ir_actions_act_window, self).__init__(pool, cr) def _amlse_add_groups(self, cr, uid, context): @@ -51,6 +54,8 @@ class ir_actions_act_window(models.Model): context = {} res = super(ir_actions_act_window, self).read( cr, uid, ids, fields=fields, context=context, load=load) + if not self._amlse_act_id: + self._amlse_act_id = self._get_amlse_act_id(cr) if ids == [self._amlse_act_id]: amlse_act = res[0] if amlse_act.get('context'): From dcf694f05844cc07e0e516ec42d8a998e9030eef Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Mon, 1 Jun 2015 17:29:12 +0200 Subject: [PATCH 7/7] add oca in manifest --- account_move_line_search_extension/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_move_line_search_extension/__openerp__.py b/account_move_line_search_extension/__openerp__.py index a2c14ac60..5b9e98e12 100644 --- a/account_move_line_search_extension/__openerp__.py +++ b/account_move_line_search_extension/__openerp__.py @@ -24,7 +24,7 @@ 'name': 'Journal Items Search Extension', 'version': '0.6', 'license': 'AGPL-3', - 'author': 'Noviat', + 'author': 'Noviat, Odoo Community Association (OCA)', 'category': 'Accounting & Finance', 'depends': ['account'], 'data': [