Browse Source

[ADD] Initial Commit

pull/60/head
Sreejith 8 years ago
parent
commit
363a99f452
  1. 26
      event_management_report/README.rst
  2. 23
      event_management_report/__init__.py
  3. 41
      event_management_report/__manifest__.py
  4. 22
      event_management_report/models/__init__.py
  5. 49
      event_management_report/models/event_report_wizard.py
  6. 23
      event_management_report/report/__init__.py
  7. 47
      event_management_report/report/event_report_parser.py
  8. 67
      event_management_report/report/event_report_pdf.xml
  9. 56
      event_management_report/report/event_report_xlsx.py
  10. 24
      event_management_report/report/event_reports.xml
  11. BIN
      event_management_report/static/description/banner.jpg
  12. BIN
      event_management_report/static/description/cybro_logo.png
  13. BIN
      event_management_report/static/description/event_report_pdf.png
  14. BIN
      event_management_report/static/description/event_report_wizard.png
  15. BIN
      event_management_report/static/description/event_report_xls.png
  16. BIN
      event_management_report/static/description/icon.png
  17. 85
      event_management_report/static/description/index.html
  18. 44
      event_management_report/views/event_report_wizard.xml

26
event_management_report/README.rst

@ -0,0 +1,26 @@
===========================
Event Management Report v10
===========================
Event Management report is a supporting module of Event_management module.
The module helps the user to generate reports of Events.
The user can generate filtered reports and export it to XLS and PDF format.
Features
========
* Filtration based on Event type.
* Filtration based on Event state.
* Both PDF and XLS report.
Contributors
============
* Avinash Nk <avinash@cybrosys.in>
Maintainer
==========
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com

23
event_management_report/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from . import models
from . import report

41
event_management_report/__manifest__.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
{
'name': 'Event Management Report',
'version': '10.0.1.0.0',
'summary': """Generates XLS and PDF Reports of Events in Event Management Module""",
'description': """Generates XLS and PDF Reports of Events in Event Management Module""",
"category": "Tools",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['event_management', 'report_xlsx'],
'data': ['views/event_report_wizard.xml',
'report/event_report_pdf.xml',
'report/event_reports.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'application': False,
}

22
event_management_report/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from . import event_report_wizard

49
event_management_report/models/event_report_wizard.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from odoo import models, fields, api
class EventManagement(models.TransientModel):
_name = 'event.management.report'
event_type = fields.Many2many('event.management.type', 'event_type_rel', 'report_id', 'type_id', string="Type",
required=True)
event_state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('invoice', 'Invoiced'),
('close', 'Close'), ('cancel', 'Canceled')], string="State")
@api.multi
def pdf_report(self):
type_select = self.event_type.ids
state_select = self.event_state
wizard_data = {"type_select": type_select, "state_select": state_select}
return self.env['report'].get_action(self, 'event_management_report.event_report_template', data=wizard_data)
@api.multi
def xls_report(self):
type_select = self.event_type.ids
state_select = self.event_state
wizard_data = {"type_select": type_select, "state_select": state_select}
return {'type': 'ir.actions.report.xml',
'report_name': 'event_management_report.event_report.xlsx',
'report_type': 'xlsx',
'datas': wizard_data,
'name': 'Event Report'}

23
event_management_report/report/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from . import event_report_parser
from . import event_report_xlsx

47
event_management_report/report/event_report_parser.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from odoo import models, api
class EventReportParser(models.AbstractModel):
_name = 'report.event_management_report.event_report_template'
@api.model
def render_html(self, docids, data):
filtered_events = self.filtered_records(data)
docargs = {
'docs': filtered_events,
'model': self,
'data': data,
}
return self.env['report'].render('event_management_report.event_report_template', docargs)
@api.multi
def filtered_records(self, data):
total_events = self.env['event.management']
type_select = data['type_select']
state_select = data['state_select']
domain = [('type_of_event', 'in', type_select)]
if state_select:
domain.append(('state', '=', state_select))
filtered_events = total_events.search(domain)
return filtered_events

67
event_management_report/report/event_report_pdf.xml

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="event_report_template">
<t t-call="report.html_container">
<t t-call="report.external_layout">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-md-12">
<h2>
<span>Event Report</span>
</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Customer</th>
<th>Date</th>
<th>Start Date</th>
<th>End Date</th>
<th>State</th>
</tr>
</thead>
<tbody>
<t t-foreach="docs" t-as="l">
<tr>
<td>
<span t-field="l.name"/>
</td>
<td>
<span t-field="l.type_of_event"/>
</td>
<td>
<span t-field="l.partner_id.name"/>
</td>
<td>
<span t-field="l.date"/>
</td>
<td>
<span t-esc="l.start_date"/>
</td>
<td>
<span t-field="l.end_date"/>
</td>
<td>
<span t-field="l.state"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
<div class="oe_structure"/>
</div>
</t>
</t>
</template>
</data>
</odoo>

56
event_management_report/report/event_report_xlsx.py

@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Avinash Nk(<avinash@cybrosys.in>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) 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 <https://www.gnu.org/licenses/>.
#
###################################################################################
from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx
class EventReportXlsx(ReportXlsx):
def generate_xlsx_report(self, workbook, data, obj):
parser_obj = self.env['report.event_management_report.event_report_template']
filtered_records = parser_obj.filtered_records(data)
sheet = workbook.add_worksheet()
format1 = workbook.add_format({'font_size': 16, 'align': 'center', 'bg_color': '#D3D3D3', 'bold': True})
format1.set_font_color('#000080')
format2 = workbook.add_format({'font_size': 10, 'bold': True})
format3 = workbook.add_format({'font_size': 10})
format1.set_align('center')
format2.set_align('center')
sheet.merge_range('A01:B01', "Name", format2)
sheet.merge_range('C01:D01', "Type", format2)
sheet.merge_range('E01:F01', "Customer", format2)
sheet.merge_range('G01:H01', "Date", format2)
sheet.merge_range('I01:J01', "Start Date", format2)
sheet.merge_range('K01:L01', "End Date", format2)
sheet.merge_range('M01:N01', "State", format2)
row_number = 1
col_number = 0
for records in filtered_records:
sheet.merge_range(row_number, col_number, row_number, col_number+1, records.name, format3)
sheet.merge_range(row_number, col_number+2, row_number, col_number+3, records.type_of_event.name, format3)
sheet.merge_range(row_number, col_number+4, row_number, col_number+5, records.partner_id.name, format3)
sheet.merge_range(row_number, col_number+6, row_number, col_number+7, records.date, format3)
sheet.merge_range(row_number, col_number+8, row_number, col_number+9, records.start_date, format3)
sheet.merge_range(row_number, col_number+10, row_number, col_number+11, records.end_date, format3)
sheet.merge_range(row_number, col_number+12, row_number, col_number+13, records.state, format3)
row_number += 1
EventReportXlsx('report.event_management_report.event_report.xlsx', 'event.management')

24
event_management_report/report/event_reports.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<report
id="event_report_pdf"
string="Event Report"
model="event.management"
report_type="qweb-pdf"
name="event_management_report.event_report_template"
file="event_management_report.event_report_template"
menu="False"/>
<report
id="event_report_xlsx"
string="Event Report"
model="event.management"
report_type="xlsx"
name="event_management_report.event_report.xlsx"
file="event_management_report.event_report.xlsx"
menu="False"/>
</data>
</odoo>

BIN
event_management_report/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
event_management_report/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
event_management_report/static/description/event_report_pdf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
event_management_report/static/description/event_report_wizard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

BIN
event_management_report/static/description/event_report_xls.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
event_management_report/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

85
event_management_report/static/description/index.html

@ -0,0 +1,85 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Event Management Report</h2>
<h3 class="oe_slogan">PDF and XLS Report of Events.</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced">
<h4><p style="margin-left: 42px;">Major Features:</p></h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Filtration based on Event type.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Filtration based on Event state.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Both PDF and XLS report.</li>
</ul>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">Event Management report is a supporting module of Event_management module. The module helps the user to generate reports of Events. The user can generate filtered reports and export it to XLS and PDF format.</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>Report Wizard</h1> </p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="event_report_wizard.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>PDF Report</h1> </p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="event_report_pdf.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p><h1>XLS Report</h1> </p>
<div class="oe_demo oe_picture oe_screenshot">
<img src="event_report_xls.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

44
event_management_report/views/event_report_wizard.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="event_report_form_view" model="ir.ui.view">
<field name="name">event_report_form_view.form</field>
<field name="model">event.management.report</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="event_type" widget="many2many_tags"/>
</group>
<group>
<field name="event_state"/>
</group>
</group>
</sheet>
<footer>
<button name="pdf_report" string="PDF" type="object" class="btn-primary"/>
or
<button name="xls_report" string="XLS" type="object" class="btn-primary"/>
or
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="event_management_report_action" model="ir.actions.act_window">
<field name="name">Event Report</field>
<field name="res_model">event.management.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="event_management_report_menu" name="Reports" parent="event_management.event_management_main_menu" groups="event_management.group_event_manager"/>
<menuitem id="event_management_event_report" name="Event Report" parent="event_management_report_menu" action="event_management_report_action"/>
</data>
</odoo>
Loading…
Cancel
Save