clearcorp team mailing list archive
-
clearcorp team
-
Mailing list archive
-
Message #00486
[Merge] lp:~rr.clearcorp/openerp-ccorp-addons/6.1-project_reports into lp:openerp-ccorp-addons
Ronald Rubi has proposed merging lp:~rr.clearcorp/openerp-ccorp-addons/6.1-project_reports into lp:openerp-ccorp-addons.
Requested reviews:
CLEARCORP drivers (clearcorp-drivers)
For more details, see:
https://code.launchpad.net/~rr.clearcorp/openerp-ccorp-addons/6.1-project_reports/+merge/142554
Add module project reports
--
https://code.launchpad.net/~rr.clearcorp/openerp-ccorp-addons/6.1-project_reports/+merge/142554
Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons.
=== added directory 'project_reports'
=== added file 'project_reports/__init__.py'
--- project_reports/__init__.py 1970-01-01 00:00:00 +0000
+++ project_reports/__init__.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import wizard
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_reports/__openerp__.py'
--- project_reports/__openerp__.py 1970-01-01 00:00:00 +0000
+++ project_reports/__openerp__.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+ 'name': 'Project Report',
+ 'version': '1.0',
+ 'url': 'http://launchpad.net/openerp-ccorp-addons',
+ 'author': 'ClearCorp S.A.',
+ 'website': 'http://clearcorp.co.cr',
+ 'category': 'Project Management',
+ 'complexity': 'normal',
+ 'description': """This module adds project reports
+ """,
+ 'depends': [
+ 'project',
+ ],
+ 'init_xml': [],
+ 'demo_xml': [],
+ 'update_xml': [
+ 'report/report.xml',
+ 'wizard/project_report_wizard.xml',
+ 'report_menus.xml',
+ ],
+ 'license': 'AGPL-3',
+ 'installable': True,
+ 'active': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'project_reports/i18n'
=== added symlink 'project_reports/i18n/es.po'
=== target is u'es_CR.po'
=== added file 'project_reports/i18n/es_CR.po'
--- project_reports/i18n/es_CR.po 1970-01-01 00:00:00 +0000
+++ project_reports/i18n/es_CR.po 2013-01-09 16:55:25 +0000
@@ -0,0 +1,124 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * project_reports
+# Ronald Rubi <ronald.rubi@xxxxxxxxxxxxxxx>, 2013.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-01-09 15:55+0000\n"
+"PO-Revision-Date: 2013-01-09 10:10-0600\n"
+"Last-Translator: Ronald Rubi <ronald.rubi@xxxxxxxxxxxxxxx>\n"
+"Language-Team: Inglés <ronald.rubi@xxxxxxxxxxxxxxx>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
+
+#. module: project_reports
+#: field:project.report.wizard,date_to:0
+msgid "End Date"
+msgstr "Fecha Final"
+
+#. module: project_reports
+#: view:project.report.wizard:0
+msgid "Dates"
+msgstr "Fechas"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:128
+#: report:addons/project_reports/report/project_report.mako:155
+msgid "Hours:"
+msgstr "Horas:"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:147
+msgid "TOTAL HOURS"
+msgstr "TOTAL DE HORAS"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:68
+msgid "Description"
+msgstr "Descripción"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:138
+#: report:addons/project_reports/report/project_report.mako:163
+msgid "Total:"
+msgstr "Total:"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:56
+msgid "to"
+msgstr "al"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:83
+msgid "Done by"
+msgstr "Realizado por"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:56
+msgid "Task of dates:"
+msgstr "Tareas del:"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:67
+msgid "Task Summary"
+msgstr "Resumen de tarea"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:55
+msgid "Project Report for Specific Dates"
+msgstr "Reporte de proyectos para fechas específicas"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:82
+msgid "Time Spent"
+msgstr "Tiempo dedicado"
+
+#. module: project_reports
+#: code:addons/project_reports/report/project_report.py:37
+#: model:ir.actions.act_window,name:project_reports.action_project_report_wizard_view
+#: model:ir.actions.report.xml,name:project_reports.project_report_webkit
+#: model:ir.ui.menu,name:project_reports.ccorp_project_report
+#: view:project.report.wizard:0
+#, python-format
+msgid "Project Report"
+msgstr "Reporte de Proyecto"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:110
+msgid "Hours Task:"
+msgstr "Horas de trabajo:"
+
+#. module: project_reports
+#: view:project.report.wizard:0
+msgid "Cancel"
+msgstr "Cancelar"
+
+#. module: project_reports
+#: model:ir.model,name:project_reports.model_project_report_wizard
+msgid "project.report.wizard"
+msgstr "project.report.wizard"
+
+#. module: project_reports
+#: field:project.report.wizard,date_from:0
+msgid "Start Date"
+msgstr "Fecha de inicio"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:81
+msgid "Work Summary "
+msgstr "Resumen del trabajo "
+
+#. module: project_reports
+#: view:project.report.wizard:0
+msgid "Validate"
+msgstr "Validar"
+
+#. module: project_reports
+#: report:addons/project_reports/report/project_report.mako:120
+msgid "HOURS PROJECT"
+msgstr "HORAS EN EL PROYECTO"
=== added directory 'project_reports/report'
=== added file 'project_reports/report/__init__.py'
--- project_reports/report/__init__.py 1970-01-01 00:00:00 +0000
+++ project_reports/report/__init__.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import project_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_reports/report/project_report.mako'
--- project_reports/report/project_report.mako 1970-01-01 00:00:00 +0000
+++ project_reports/report/project_report.mako 2013-01-09 16:55:25 +0000
@@ -0,0 +1,168 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style type="text/css">
+ .account_level_1 {
+ text-transform: uppercase;
+ font-size: 15px;
+ background-color:#F0F0F0;
+ }
+
+ .account_level_2 {
+ font-size: 12px;
+ background-color:#F0F0F0;
+ }
+
+ .regular_account_type {
+ font-weight: normal;
+ }
+
+ .view_account_type {
+ font-weight: bold;
+ }
+
+ .account_level_consol {
+ font-weight: normal;
+ font-style: italic;
+ }
+
+ ${css}
+
+ .list_table .act_as_row {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-size:10px;
+ }
+ </style>
+ </head>
+ <body class = "data">
+ <%
+ import copy
+
+ setLang(user.context_lang)
+ start_date = data['form']['date_from']
+ end_date = data['form']['date_to']
+ project_task_works = get_project_task_works_by_dates(cr, uid, start_date, end_date)
+ project_tasks = get_project_tasks(cr, uid, project_task_works)
+ projects = get_projects(cr, uid, project_tasks)
+ user_hours_total = get_user_hours(cr, uid, project_task_works)
+ user_hours_project = copy.deepcopy(user_hours_total)
+
+ total_hours = 0.00
+ %>
+ <br></br>
+ <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${company.partner_id.name}</div>
+ <div style="font-size: 25px; font-weight: bold; text-align: center;"> ${_('Project Report for Specific Dates')}</div>
+ <div style="font-size: 20px; font-weight: bold; text-align: center;">${_('Task of dates:')} ${start_date} ${_('to')} ${end_date}</div>
+ %for project in projects:
+ <br></br>
+ <% total_hours_project = 0.00 %>
+ <div style="font-size: 16px; font-weight: bold; text-align: left;">${project.complete_name or ' '}</div>
+ %for project_task in project_tasks:
+ <% total_hours_project_task = 0.00 %>
+ %if project_task.project_id.id == project.id:
+ <div class="act_as_table list_table">
+ <div class="act_as_thead">
+ <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
+ <div class="act_as_cell first_column" style="vertical-align: middle; text-align:center;">${_('Task Summary')}</div>
+ <div class="act_as_cell amount" style="vertical-align: middle; text-align:center;">${_('Description')}</div>
+ </div>
+ </div>
+ <div class="act_as_tbody">
+ <div class="act_as_row lines">
+ <div class="act_as_cell">${project_task.name or ' '}</div>
+ <div class="act_as_cell">${project_task.description or ' '}</div>
+ </div>
+ </div>
+ </div>
+ <div class="act_as_table data_table " style="width: 500px; margin-left:auto; margin-right:auto;">
+ <div class="act_as_thead" style="align:center">
+ <div class="act_as_row lines">
+ <div class="act_as_cell" style="text-align:center;"><b>${_('Work Summary ')}</b></div>
+ <div class="act_as_cell" style="text-align:center;"><b>${_('Time Spent')}</b></div>
+ <div class="act_as_cell" style="text-align:center;"><b>${_('Done by')}</b></div>
+ </div>
+ </div>
+ <div class="act_as_tbody">
+ %for project_task_work in project_task.work_ids:
+ %if project_task_work in project_task_works:
+ <div class="act_as_row lines">
+ <div class="act_as_cell"style="text-align:center;">${project_task_work.name or ' '}</div>
+ <%
+ hours_project_task_work = round(project_task_work.hours, 2)
+ total_hours_project_task = total_hours_project_task + project_task_work.hours
+ user_hours_project[project_task_work.user_id.name] = user_hours_project[project_task_work.user_id.name] + project_task_work.hours
+ user_hours_total[project_task_work.user_id.name] = user_hours_total[project_task_work.user_id.name] + project_task_work.hours
+ %>
+ <div class="act_as_cell"style="text-align:center;">${hours_project_task_work or ' '}</div>
+ <div class="act_as_cell"style="text-align:center;">${project_task_work.user_id.name or ' '}</div>
+ </div>
+ %endif
+ %endfor
+ </div>
+ </div>
+ </div>
+ <div class="act_as_thead">
+ <div class="act_as_row labels" style="font-weight: bold; font-size: 9px;">
+ <%
+ hours_project_task = round(total_hours_project_task, 2)
+ %>
+ <div class="act_as_cell" style="vertical-align: middle">${_('Hours Task:')} ${hours_project_task}</div>
+ </div>
+ </div>
+ <% total_hours_project = total_hours_project + total_hours_project_task %>
+ <br />
+ %endif
+ %endfor
+ <div class="act_as_table data_table " style="width: 500px; margin-left:30%; margin-right:auto;">
+ <div class="act_as_thead" style="align:center">
+ <div class="act_as_row lines">
+ <div class="act_as_cell" style="vertical-align: middle; font-weight: bold; font-size: 13px;">${_('HOURS PROJECT')}</div><br/>
+ </div>
+ %for key in user_hours_project.keys():
+ <div class="act_as_row lines">
+ %if user_hours_project[key] != 0.00:
+ <%
+ hours_project_user = round(user_hours_project[key], 2)
+ %>
+ <div class="act_as_cell" style="vertical-align: middle; font-size: 11px;">${key} ${_('Hours:')} ${hours_project_user}</div><br/>
+ %endif
+ <% user_hours_project[key] = 0.00 %>
+ </div>
+ %endfor
+ <div class="act_as_row lines">
+ <%
+ hours_project = round(total_hours_project, 2)
+ total_hours = total_hours + total_hours_project
+ %>
+ <div class="act_as_cell" style="vertical-align: middle; font-weight: bold; font-size: 11px;">${_('Total:')} ${hours_project}</div><br/>
+ </div>
+ </div>
+ </div>
+ %endfor
+ <br/><br/>
+ <div class="act_as_table data_table " style="width: 500px; margin-left:30%; margin-right:auto;">
+ <div class="act_as_thead" style="align:center">
+ <div class="act_as_row lines">
+ <div class="act_as_cell" style="vertical-align: middle; font-weight: bold; font-size: 13px;">${_('TOTAL HOURS')}</div><br/>
+ </div>
+ %for key in user_hours_total.keys():
+ <div class="act_as_row lines">
+ %if user_hours_total[key] != 0.00:
+ <%
+ hours_total_user = round(user_hours_total[key], 2)
+ %>
+ <div class="act_as_cell" style="vertical-align: middle; font-size: 13px;">${key} ${_('Hours:')} ${hours_total_user}</div><br/>
+ %endif
+ </div>
+ %endfor
+ <div class="act_as_row lines">
+ <%
+ hours_total = round(total_hours, 2)
+ %>
+ <div class="act_as_cell" style="vertical-align: middle; font-weight: bold; font-size: 13px;">${_('Total:')} ${hours_total}</div><br/>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
=== added file 'project_reports/report/project_report.py'
--- project_reports/report/project_report.py 1970-01-01 00:00:00 +0000
+++ project_reports/report/project_report.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import pooler
+import time
+from report import report_sxw
+from tools.translate import _
+
+class project_report_report(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(project_report_report, self).__init__(cr, uid, name, context=context)
+ self.pool = pooler.get_pool(self.cr.dbname)
+ self.cursor = self.cr
+ self.localcontext.update({
+ 'time': time,
+ 'cr' : cr,
+ 'uid': uid,
+ 'report_name':_('Project Report'),
+ 'get_project_task_works_by_dates': self.get_project_task_works_by_dates,
+ 'get_project_tasks': self.get_project_tasks,
+ 'get_projects': self.get_projects,
+ 'get_user_hours': self.get_user_hours,
+ })
+
+ def get_project_task_works_by_dates(self, cr, uid, start_date, end_date):
+ project_task_work_obj = self.pool.get('project.task.work')
+ project_task_work_ids = project_task_work_obj.search(cr, uid, [('date','>=',start_date), ('date','<=',end_date)])
+ project_task_works = project_task_work_obj.browse(cr, uid, project_task_work_ids)
+ return project_task_works
+
+ def get_project_tasks(self, cr, uid, project_task_works):
+ project_tasks = []
+ for project_task_work in project_task_works:
+ if project_task_work.task_id not in project_tasks:
+ project_tasks.append(project_task_work.task_id)
+ return project_tasks
+
+ def get_projects(self, cr, uid, project_tasks):
+ projects = []
+ for project_task in project_tasks:
+ if project_task.project_id and project_task.project_id not in projects:
+ projects.append(project_task.project_id)
+ return projects
+
+ def get_user_hours(self, cr, uid, project_task_works):
+ user_hours = {}
+ for project_task_work in project_task_works:
+ if project_task_work.user_id.name not in user_hours and project_task_work.task_id.project_id:
+ user_hours[project_task_work.user_id.name] = 0.00
+ return user_hours
+
+report_sxw.report_sxw('report.project_report_report',
+ 'project.project',
+ 'addons/project_reports/report/project_report.mako',
+ parser=project_report_report, header=False)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_reports/report/report.xml'
--- project_reports/report/report.xml 1970-01-01 00:00:00 +0000
+++ project_reports/report/report.xml 2013-01-09 16:55:25 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="project_report_webkit" model="ir.actions.report.xml">
+ <field name="report_type">webkit</field>
+ <field name="report_name">project_report_report</field>
+ <field eval="[(6,0,[])]" name="groups_id"/>
+ <field eval="0" name="multi"/>
+ <field eval="0" name="auto"/>
+ <field eval="1" name="header"/>
+ <field name="model">project.report.wizard</field>
+ <field name="type">ir.actions.report.xml</field>
+ <field name="name">Project Report</field>
+ <field name="report_rml">project_reports/report/project_report.mako</field>
+ <field name="report_file">project_reports/report/project_report.mako</field>
+ </record>
+
+ </data>
+</openerp>
=== added file 'project_reports/report_menus.xml'
--- project_reports/report_menus.xml 1970-01-01 00:00:00 +0000
+++ project_reports/report_menus.xml 2013-01-09 16:55:25 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <menuitem icon="STOCK_PRINT" name="Project Report"
+ parent="project.project_report_task" action="action_project_report_wizard_view"
+ id="ccorp_project_report"/>
+
+ </data>
+</openerp>
=== added directory 'project_reports/wizard'
=== added file 'project_reports/wizard/__init__.py'
--- project_reports/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ project_reports/wizard/__init__.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import project_report_wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_reports/wizard/project_report_wizard.py'
--- project_reports/wizard/project_report_wizard.py 1970-01-01 00:00:00 +0000
+++ project_reports/wizard/project_report_wizard.py 2013-01-09 16:55:25 +0000
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Addons modules by CLEARCORP S.A.
+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+
+class project_report_wizard (osv.osv_memory):
+ _name = 'project.report.wizard'
+ _columns = {
+ 'date_from' : fields.date('Start Date', required=True),
+ 'date_to' : fields.date('End Date', required=True),
+ }
+
+
+ def _print_report(self, cursor, uid, ids, datas, context=None):
+ context = context or {}
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'project_report_report',
+ 'datas': datas}
+
+ def action_validate(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ datas = {}
+ datas['ids'] = context.get('active_ids', [])
+ datas['model'] = context.get('active_model', 'ir.ui.menu')
+ datas['form'] = self.read(cr, uid, ids, ['date_from', 'date_to'], context=context)[0]
+ return self._print_report(cr, uid, ids, datas, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_reports/wizard/project_report_wizard.xml'
--- project_reports/wizard/project_report_wizard.xml 1970-01-01 00:00:00 +0000
+++ project_reports/wizard/project_report_wizard.xml 2013-01-09 16:55:25 +0000
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data>
+
+ <!-- Project Report -->
+ <record id="project_report_wizard_form_view" model="ir.ui.view">
+ <field name="name">project_report_wizard.form.view</field>
+ <field name="model">project.report.wizard</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Project Report">
+ <separator string="Dates" colspan="4"/>
+ <field name="date_from" />
+ <field name="date_to" />
+ <newline/>
+ <label/>
+ <newline/>
+ <button name="action_cancel" type="special" special="cancel" icon="gtk-cancel" string="Cancel" colspan="2" />
+ <button name="action_validate" type="object" icon="gtk-apply" string="Validate" colspan="2" />
+ </form>
+ </field>
+ </record>
+
+ <!-- Action -->
+
+ <record id="action_project_report_wizard_view" model="ir.actions.act_window">
+ <field name="name">Project Report</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">project.report.wizard</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="project_report_wizard_form_view"/>
+ <field name="target">new</field>
+ </record>
+
+ </data>
+</openerp>
Follow ups