From e00f767a6553dd06da860c600c1138e346af3470 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Wed, 24 Sep 2008 16:15:36 +0530 Subject: [PATCH 1/2] * search by model. bzr revid: ame@tinyerp.com-20080924104536-w6sdgmueia4t9dmq --- addons/process/process.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/process/process.py b/addons/process/process.py index 49f6c8dc83a..1a0024af4b1 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -63,6 +63,29 @@ class process_process(osv.osv): 'active' : lambda *a: True, } + def search_by_model(self, cr, uid, res_model, context): + pool = pooler.get_pool(cr.dbname) + + model_ids = pool.get('ir.model').search(cr, uid, [('model', '=', res_model)]) + if not model_ids: + return [] + + nodes = pool.get('process.node').search(cr, uid, [('model_id', 'in', model_ids)]) + if not nodes: + return [] + + nodes = pool.get('process.node').browse(cr, uid, nodes, context) + + unique = [] + result = [] + + for node in nodes: + if node.process_id.id not in unique: + result.append((node.process_id.id, node.process_id.name)) + unique.append(node.process_id.id) + + return result + def graph_get(self, cr, uid, id, res_model, res_id, scale, context): pool = pooler.get_pool(cr.dbname) From 32518af10916aa8242c44fc33328f96ff0ffbc0d Mon Sep 17 00:00:00 2001 From: Harshad Modi Date: Wed, 24 Sep 2008 16:24:26 +0530 Subject: [PATCH 2/2] added wizard to open entries for analytical account by selecting date on Account analytical entry list view bzr revid: hmo@tinyerp.com-20080924105426-yqf4pcm7isoezm7p --- addons/account/project/project_view.xml | 6 +- addons/account/project/wizard/__init__.py | 1 + .../wizard/wizard_account_analytic_line.py | 86 +++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 addons/account/project/wizard/wizard_account_analytic_line.py diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 5178b07eea8..45a4307a6c9 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -150,7 +150,9 @@ form - + + + @@ -238,7 +240,7 @@ # - account.analytic.journal.open.form + Entries of Open Analytic Journals account.analytic.line form tree,form diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py index 0e66d867caa..477e5262a00 100644 --- a/addons/account/project/wizard/__init__.py +++ b/addons/account/project/wizard/__init__.py @@ -34,6 +34,7 @@ import wizard_account_analytic_inverted_balance_report import wizard_account_analytic_cost_ledger_report import wizard_account_analytic_cost_ledger_for_journal_report import wizard_account_analytic_analytic_check +import wizard_account_analytic_line # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/project/wizard/wizard_account_analytic_line.py b/addons/account/project/wizard/wizard_account_analytic_line.py new file mode 100644 index 00000000000..143737ab153 --- /dev/null +++ b/addons/account/project/wizard/wizard_account_analytic_line.py @@ -0,0 +1,86 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler +import time + +def _action_open_window(self, cr, uid, data, context): + domain=[] + from_date= data['form']['from_date'] + to_date=data['form']['to_date'] + if from_date and to_date: + domain=[('date','>=',from_date),('date','<=',to_date)] + elif from_date: + domain=[('date','>=',from_date)] + elif to_date: + domain=[('date','<=',to_date)] + return { + 'name': 'Analytic Entries', + 'view_type': 'form', + "view_mode": 'tree,form', + 'res_model': 'account.analytic.line', + 'type': 'ir.actions.act_window', + 'domain': domain} + + +class account_analytic_line(wizard.interface): + form1 = ''' +
+ + + + + +