From 3e5251aa00507bfdcbea31e9b6099895012a29fb Mon Sep 17 00:00:00 2001 From: pinky <> Date: Wed, 20 Dec 2006 05:57:18 +0000 Subject: [PATCH] New report system bzr revid: pinky-5f8b8fd96a887e09d6d4b879cb3590bb3b5f1cce --- addons/account/invoice.py | 1 + addons/l10n_ch/__terp__.py | 4 +- addons/report_analytic_line/__init__.py | 2 + addons/report_analytic_line/__terp__.py | 6 +- .../report_analytic_line/report/__init__.py | 29 +++ .../report/report_planning.rml | 220 ++++++++++++++++++ .../report_analytic_planning.py | 10 + 7 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 addons/report_analytic_line/report/__init__.py create mode 100644 addons/report_analytic_line/report/report_planning.rml diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 9e9484fd6ce..174b53d1b81 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -62,6 +62,7 @@ class account_invoice(osv.osv): return cr.fetchone()[0] def _get_currency(self, cr, uid, context): + return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0] return pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0].company_id.currency_id.id def _get_journal_analytic(self, cr, uid, type_inv, context={}): diff --git a/addons/l10n_ch/__terp__.py b/addons/l10n_ch/__terp__.py index e4990649671..4ae117b8b42 100755 --- a/addons/l10n_ch/__terp__.py +++ b/addons/l10n_ch/__terp__.py @@ -8,8 +8,8 @@ "category" : "Localisation/Europe", "website": "http://www.tinyerp.com", "depends" : ["base", "account"], -# "init_xml" : [], - "init_xml" : ["zip_code_default.xml"], + "init_xml" : [], +# "init_xml" : ["zip_code_default.xml"], "demo_xml" : ["vaudtax_data_demo.xml","dta/dta_demo.xml"], "update_xml" : [ "dta/dta_view.xml","dta/dta_wizard.xml", diff --git a/addons/report_analytic_line/__init__.py b/addons/report_analytic_line/__init__.py index 74cf1e7f2f9..d2693782e4b 100644 --- a/addons/report_analytic_line/__init__.py +++ b/addons/report_analytic_line/__init__.py @@ -29,3 +29,5 @@ import report_analytic_line import report_analytic_planning + +import report diff --git a/addons/report_analytic_line/__terp__.py b/addons/report_analytic_line/__terp__.py index 714f9854201..9cce1319ed1 100644 --- a/addons/report_analytic_line/__terp__.py +++ b/addons/report_analytic_line/__terp__.py @@ -8,7 +8,11 @@ "description": "A report on analytic lines, costs by products, months and accounts.", "init_xml" : [], "demo_xml" : [], - "update_xml" : ["report_analytic_line_view.xml", "report_analytic_planning_view.xml"], + "update_xml" : [ + "report_analytic_line_view.xml", + "report_analytic_planning_view.xml", + "report_analytic_planning_report.xml" + ], "active": False, "installable": True } diff --git a/addons/report_analytic_line/report/__init__.py b/addons/report_analytic_line/report/__init__.py new file mode 100644 index 00000000000..16195f2f1e0 --- /dev/null +++ b/addons/report_analytic_line/report/__init__.py @@ -0,0 +1,29 @@ +############################################################################## +# +# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $ +# +# 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. +# +############################################################################## + diff --git a/addons/report_analytic_line/report/report_planning.rml b/addons/report_analytic_line/report/report_planning.rml new file mode 100644 index 00000000000..829d8b689b6 --- /dev/null +++ b/addons/report_analytic_line/report/report_planning.rml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects, 'o') ]] + + + + [[ company.name ]] + + + HR Planning + + + + + + + + + + Responsible: [[ o.user_id.name ]] + + + [[ o.name]] + + + From: [[ o.date_from ]] + To: [[ o.date_to ]] + + + + + + + + + + Summary by project + + + + + + + Project + + + Quantities + + + + + [[ repeatIn(o.stat_account_ids , 'p') ]] [ [[ p.account_id.code ]] ] [[ p.account_id.complete_name ]] + + + [[ p.quantity ]] + + + + + + + + + + Summary by user + + + + + + + User + + + Quantities + + + + + [[ repeatIn(o.stat_user_ids, 'u') ]] [[ u.user_id.name ]] + + + [[ u.quantity ]] + + + + + + + + + + Details of user's time by projects + + + + + + + User + + + Project + + + Planned + + + Tasks + + + Real + + + + + [[ repeatIn(o.stat_ids, 'l') ]] [[ l.user_id.name ]] + + + [ [[ l.account_id.code ]] ] [[ l.account_id.name ]] + + + [[ l.sum_amount ]] + + + [[ l.sum_amount_tasks ]] + + + [[ l.sum_amount_real ]] + + + + + + + + + diff --git a/addons/report_analytic_line/report_analytic_planning.py b/addons/report_analytic_line/report_analytic_planning.py index 5e0b3a2baa1..5ccffe08b63 100644 --- a/addons/report_analytic_line/report_analytic_planning.py +++ b/addons/report_analytic_line/report_analytic_planning.py @@ -29,6 +29,9 @@ from osv import fields,osv +import time +import mx.DateTime + class report_account_analytic_planning(osv.osv): _name = "report_account_analytic.planning" _description = "Planning" @@ -42,6 +45,12 @@ class report_account_analytic_planning(osv.osv): 'stat_user_ids': fields.one2many('report_account_analytic.planning.stat.user', 'planning_id', 'Planning by user', readonly=True), 'stat_account_ids': fields.one2many('report_account_analytic.planning.stat.account', 'planning_id', 'Planning by account', readonly=True), } + _defaults = { + 'name': lambda *a: time.strftime('%Y-%m-%d'), + 'date_from': lambda *a: time.strftime('%Y-%m-01'), + 'date_to': lambda *a: (mx.DateTime.now()+mx.DateTime.RelativeDateTime(months=1,day=1,days=-1)).strftime('%Y-%m-%d'), + 'user_id': lambda self,cr,uid,c: uid + } _order = 'date_from desc' report_account_analytic_planning() @@ -125,6 +134,7 @@ class report_account_analytic_planning_stat(osv.osv): 'sum_amount_real': fields.function(_sum_amount_real, method=True, string='Work made'), 'sum_amount_tasks': fields.function(_sum_amount_tasks, method=True, string='Tasks made'), } + _order = 'planning_id,user_id' def init(self, cr): cr.execute(""" create or replace view report_account_analytic_planning_stat as (