diff --git a/project_report_pdf/README.rst b/project_report_pdf/README.rst new file mode 100644 index 000000000..202ae9d16 --- /dev/null +++ b/project_report_pdf/README.rst @@ -0,0 +1,25 @@ +Project Report +============== +PDF and XLS Reports for Project Module. + + +Features +======== +* Project Tasks & Issues Report XLS [With advanced Filtration] +* Project Tasks & Issues Report PDF [With advanced Filtration] + +Installation +============ +To install this module, you need also the **report_xlsx** +module located in: +https://github.com/OCA/reporting-engine/tree/9.0/report_xlsx + +Credits +======= +Cybrosys Techno Solutions + +Author +------ +* Developer: Avinash Nk @ cybrosys +* Guidance: Nilmar Shereef @ cybrosys, shereef@cybrosys.in + diff --git a/project_report_pdf/__init__.py b/project_report_pdf/__init__.py new file mode 100644 index 000000000..00a9a813c --- /dev/null +++ b/project_report_pdf/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models +import report diff --git a/project_report_pdf/__openerp__.py b/project_report_pdf/__openerp__.py new file mode 100644 index 000000000..bf27a7ea6 --- /dev/null +++ b/project_report_pdf/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Project Report XLS & PDF', + 'version': '0.3', + "category": "Project", + 'author': 'Cybrosys Techno Solutions', + 'website': "http://www.cybrosys.com", + 'company': 'Cybrosys Techno Solutions', + 'summary': """This Module gives PDF & XLS Reports for Project With Advanced Filtrations""", + 'depends': ['base', 'project', 'project_issue', 'report_xlsx'], + 'license': 'AGPL-3', + 'data': ['views/wizard_report.xml', + 'views/project_report_pdf_view.xml', + 'views/project_report_button.xml', + 'views/project_report.xml' + ], + 'images': ['static/description/banner.jpg'], + 'installable': True, + 'auto_install': False, +} diff --git a/project_report_pdf/models/__init__.py b/project_report_pdf/models/__init__.py new file mode 100644 index 000000000..521d178e9 --- /dev/null +++ b/project_report_pdf/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import project_report +import project_report_parser diff --git a/project_report_pdf/models/project_report.py b/project_report_pdf/models/project_report.py new file mode 100644 index 000000000..528b61a01 --- /dev/null +++ b/project_report_pdf/models/project_report.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from openerp import models, fields, api, _ + + +class ProjectReportButton(models.TransientModel): + _name = 'wizard.project.report' + + task_select = fields.Boolean(string="Task", default=True) + issue_select = fields.Boolean(string="Issue", default=True) + partner_select = fields.Many2many('res.users', string='Assigned to') + stage_select = fields.Many2many('project.task.type', string="Stage") + + @api.multi + def print_project_report_pdf(self): + + active_record = self._context['active_id'] + record = self.env['project.project'].browse(active_record) + return self.env['report'].get_action(record, "project_report_pdf.project_report_transition") + + @api.multi + def print_project_report_xls(self): + context = self._context + datas = {'ids': context.get('active_ids', [])} + datas['model'] = 'project.project' + datas['form'] = self.read()[0] + for field in datas['form'].keys(): + if isinstance(datas['form'][field], tuple): + datas['form'][field] = datas['form'][field][0] + return {'type': 'ir.actions.report.xml', + 'report_name': 'project_report_pdf.project_report_xls.xlsx', + 'datas': datas, + 'name': 'Project Report' + } diff --git a/project_report_pdf/models/project_report_parser.py b/project_report_pdf/models/project_report_parser.py new file mode 100644 index 000000000..61af5a9fd --- /dev/null +++ b/project_report_pdf/models/project_report_parser.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from openerp.report import report_sxw +from openerp.osv import osv +from openerp.http import request + + +class ProjectReportParser(report_sxw.rml_parse): + + def __init__(self, cr, uid, name, context=None): + + super(ProjectReportParser, self).__init__(cr, uid, name, context=context) + + self.localcontext.update({ + 'get_task_model': self.get_task_model, + 'get_issue_model': self.get_issue_model, + 'get_list_model_task': self.get_list_model_task, + 'get_list_model_issue': self.get_list_model_issue, + + }) + self.context = context + + def get_task_model(self, name): + wizard_record = request.env['wizard.project.report'].search([])[-1] + task_obj = request.env['project.task'] + users_selected = [] + stages_selected = [] + for elements in wizard_record.partner_select: + users_selected.append(elements.id) + for elements in wizard_record.stage_select: + stages_selected.append(elements.id) + if len(wizard_record.partner_select) == 0: + if len(wizard_record.stage_select) == 0: + current_task_obj = task_obj.search([('project_id', '=', name)]) + return current_task_obj + else: + current_task_obj = task_obj.search([('project_id', '=', name), ('stage_id', 'in', stages_selected)]) + return current_task_obj + else: + if len(wizard_record.stage_select) == 0: + current_task_obj = task_obj.search([('project_id', '=', name), ('user_id', 'in', users_selected)]) + return current_task_obj + else: + current_task_obj = task_obj.search( + [('project_id', '=', name), ('user_id', 'in', users_selected), ('stage_id', 'in', stages_selected)]) + return current_task_obj + + def get_issue_model(self, name): + wizard_record = request.env['wizard.project.report'].search([])[-1] + issue_obj = request.env['project.issue'] + task_obj = issue_obj + users_selected = [] + stages_selected = [] + for elements in wizard_record.partner_select: + users_selected.append(elements.id) + for elements in wizard_record.stage_select: + stages_selected.append(elements.id) + if len(wizard_record.partner_select) == 0: + if len(wizard_record.stage_select) == 0: + current_task_obj = task_obj.search([('project_id', '=', name)]) + return current_task_obj + else: + current_task_obj = task_obj.search([('project_id', '=', name), ('stage_id', 'in', stages_selected)]) + return current_task_obj + else: + if len(wizard_record.stage_select) == 0: + current_task_obj = task_obj.search([('project_id', '=', name), ('user_id', 'in', users_selected)]) + return current_task_obj + else: + current_task_obj = task_obj.search( + [('project_id', '=', name), ('user_id', 'in', users_selected), ('stage_id', 'in', stages_selected)]) + return current_task_obj + + def get_list_model_task(self, name): + wizard_record = request.env['wizard.project.report'].search([])[-1] + if wizard_record.task_select == True: + return 2 + else: + return 3 + + def get_list_model_issue(self, name): + wizard_record = request.env['wizard.project.report'].search([])[-1] + if wizard_record.issue_select == True: + return 2 + else: + return 3 + + +class PrintReportProject(osv.AbstractModel): + + _name = 'report.project_report_pdf.project_report_transition' + _inherit = 'report.abstract_report' + _template = 'project_report_pdf.project_report_transition' + _wrapped_report_class = ProjectReportParser + + diff --git a/project_report_pdf/report/__init__.py b/project_report_pdf/report/__init__.py new file mode 100644 index 000000000..4e04ec282 --- /dev/null +++ b/project_report_pdf/report/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import project_report_xls diff --git a/project_report_pdf/report/project_report_xls.py b/project_report_pdf/report/project_report_xls.py new file mode 100644 index 000000000..abb6247ca --- /dev/null +++ b/project_report_pdf/report/project_report_xls.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2009-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx + + +class ProjectReportXls(ReportXlsx): + + def generate_xlsx_report(self, workbook, data, lines): + + sheet = workbook.add_worksheet() + format1 = workbook.add_format({'font_size': 22, 'bg_color': '#D3D3D3'}) + format4 = workbook.add_format({'font_size': 22}) + format2 = workbook.add_format({'font_size': 12, 'bold': True, 'bg_color': '#D3D3D3'}) + format3 = workbook.add_format({'font_size': 10}) + format5 = workbook.add_format({'font_size': 10, 'bg_color': '#FFFFFF'}) + format7 = workbook.add_format({'font_size': 10, 'bg_color': '#FFFFFF'}) + format6 = workbook.add_format({'font_size': 22, 'bg_color': '#FFFFFF'}) + format7.set_align('center') + sheet.merge_range('A1:B1', lines.company_id.name, format5) + sheet.merge_range('A2:B2', lines.company_id.street, format5) + sheet.write('A3', lines.company_id.city, format5) + sheet.write('B3', lines.company_id.zip, format5) + sheet.merge_range('A4:B4', lines.company_id.state_id.name, format5) + sheet.merge_range('A5:B5', lines.company_id.country_id.name, format5) + sheet.merge_range('G1:H1', lines.company_id.rml_header1, format5) + sheet.merge_range(5, 0, 6, 1, "Project :", format1) + sheet.merge_range(5, 2, 6, 7, lines.name, format1) + sheet.merge_range('A8:B8', "Project Manager :", format5) + sheet.merge_range('C8:D8', lines.user_id.name, format5) + if lines.date_start: + date_start = lines.date_start + else: + date_start = "" + if lines.date: + date_end = lines.date + else: + date_end = "" + sheet.merge_range('A9:B9', "Start Date :", format5) + sheet.merge_range('C9:D9', date_start, format5) + sheet.merge_range('A10:B10', "End Date :", format5) + sheet.merge_range('C10:D10', date_end, format5) + row_number = 10 + + sheet.merge_range(0, 2, 4, 5, "", format5) + sheet.merge_range(1, 6, 4, 7, "", format5) + sheet.merge_range(7, 4, 9, 7, "", format5) + + + if data['form']['task_select'] == True : + + sheet.merge_range(10, 4, 11, 7, "", format5) + sheet.merge_range(row_number, 0, row_number+1, 3, "Open Tasks", format4) + row_number += 2 + task_obj = self.env['project.task'] + if len(data['form']['partner_select']) == 0: + if len(data['form']['stage_select']) == 0: + current_task_obj = task_obj.search([('project_id', '=', lines.id)]) + else: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('stage_id', 'in', data['form']['stage_select'])]) + else: + if len(data['form']['stage_select']) == 0: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('user_id', 'in', data['form']['partner_select'])]) + else: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('user_id', 'in', data['form']['partner_select']), + ('stage_id', 'in', data['form']['stage_select'])]) + + sheet.merge_range(row_number, 0, row_number, 3, "Tasks", format2) + sheet.merge_range(row_number, 4, row_number, 5, "Assigned", format2) + sheet.merge_range(row_number, 6, row_number, 7, "Stage", format2) + for records in current_task_obj: + row_number += 1 + if records.user_id.name: + user_name = records.user_id.name + else: + user_name = "" + sheet.merge_range(row_number, 0, row_number, 3, records.name, format3) + sheet.merge_range(row_number, 4, row_number, 5, user_name, format3) + sheet.merge_range(row_number, 6, row_number, 7, records.stage_id.name, format3) + row_number += 1 + if data['form']['issue_select'] == True : + + row_number += 1 + sheet.merge_range(row_number-1, 0, row_number-1, 7, "", format4) + sheet.merge_range(row_number, 4, row_number + 1, 7, "", format5) + sheet.merge_range(row_number, 0, row_number+1, 3, "Open Issues", format6) + row_number += 2 + task_obj = self.env['project.issue'] + + + if len(data['form']['partner_select']) == 0: + if len(data['form']['stage_select']) == 0: + current_task_obj = task_obj.search([('project_id', '=', lines.id)]) + else: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('stage_id', 'in', data['form']['stage_select'])]) + else: + if len(data['form']['stage_select']) == 0: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('user_id', 'in', data['form']['partner_select'])]) + else: + current_task_obj = task_obj.search( + [('project_id', '=', lines.id), ('user_id', 'in', data['form']['partner_select']), + ('stage_id', 'in', data['form']['stage_select'])]) + + sheet.merge_range(row_number, 0, row_number, 3, "Issues", format2) + sheet.merge_range(row_number, 4, row_number, 5, "Assigned", format2) + sheet.merge_range(row_number, 6, row_number, 7, "Stage", format2) + for records in current_task_obj: + row_number += 1 + if records.user_id.name: + user_name = records.user_id.name + else: + user_name = "" + sheet.merge_range(row_number, 0, row_number, 3, records.name, format3) + sheet.merge_range(row_number, 4, row_number, 5, user_name, format3) + sheet.merge_range(row_number, 6, row_number, 7, records.stage_id.name, format3) + row_number += 2 + sheet.merge_range(row_number, 0, row_number, 1, lines.company_id.phone, format7) + sheet.merge_range(row_number, 2, row_number, 4, lines.company_id.email, format7) + sheet.merge_range(row_number, 5, row_number, 7, lines.company_id.website, format7) + +ProjectReportXls('report.project_report_pdf.project_report_xls.xlsx', 'project.project') \ No newline at end of file diff --git a/project_report_pdf/static/description/banner.jpg b/project_report_pdf/static/description/banner.jpg new file mode 100644 index 000000000..dc1532704 Binary files /dev/null and b/project_report_pdf/static/description/banner.jpg differ diff --git a/project_report_pdf/static/description/cybro_logo.png b/project_report_pdf/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/project_report_pdf/static/description/cybro_logo.png differ diff --git a/project_report_pdf/static/description/icon.png b/project_report_pdf/static/description/icon.png new file mode 100644 index 000000000..9eaea5ed1 Binary files /dev/null and b/project_report_pdf/static/description/icon.png differ diff --git a/project_report_pdf/static/description/index.html b/project_report_pdf/static/description/index.html new file mode 100644 index 000000000..31a99185a --- /dev/null +++ b/project_report_pdf/static/description/index.html @@ -0,0 +1,129 @@ +
+
+

Project Report PDF & XLS

+

This Module Gives You The PDF and XLS Report of + Project.

+

Cybrosys Technologies , www.cybrosys.com

+
+
+
+ This report prints the Tasks and Issues Related to the Project. + You can filter the report based on Tasks or Issues, Assigned User + and Stage of the Task/Issue +
+
+
+
+ ☛ Installation : You need report_xlsx module to run this properly. More details see the README.rst file of this module. +
+
+
+
+

+ Go to Project -> Project. +

+ And then Select One Project.Then you can see a print button. + Click that button. +

+
+
+
+ +
+
+
+
+ +
+
+
+

+ Then a wizard will open. You can filter the project report + by selecting the Appropriate options from the wizard. + if you don't select "Assigned to" & "Stage" in the wizard, + then system automatically select all the users and stages. +

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+

+ * PDF Report Of Data Import/Export Plugin Project.(Both Tasks and Issues) +

+
+
+
+
+
+
+

+ * PDF Report Of Data Import/Export Plugin Project.(Issues Only) +

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+

+ * XLS Report Of Data Import/Export Plugin Project.(Both Tasks and Issues) +

+
+
+
+
+
+
+

+ * XLS Report Of Data Import/Export Plugin Project.(Issues Only) +

+
+
+
+ +
+
+
+
+
+

Need Any Help?

+ + +
diff --git a/project_report_pdf/static/description/screen_shot_modules_location.png b/project_report_pdf/static/description/screen_shot_modules_location.png new file mode 100644 index 000000000..9b4b1ff6e Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_modules_location.png differ diff --git a/project_report_pdf/static/description/screen_shot_pdf_report.png b/project_report_pdf/static/description/screen_shot_pdf_report.png new file mode 100644 index 000000000..cd7ab25c1 Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_pdf_report.png differ diff --git a/project_report_pdf/static/description/screen_shot_pdf_report_2.png b/project_report_pdf/static/description/screen_shot_pdf_report_2.png new file mode 100644 index 000000000..e00e8eeb7 Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_pdf_report_2.png differ diff --git a/project_report_pdf/static/description/screen_shot_wizard.png b/project_report_pdf/static/description/screen_shot_wizard.png new file mode 100644 index 000000000..ce0f7ded7 Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_wizard.png differ diff --git a/project_report_pdf/static/description/screen_shot_xls_report.png b/project_report_pdf/static/description/screen_shot_xls_report.png new file mode 100644 index 000000000..55ee8c8f8 Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_xls_report.png differ diff --git a/project_report_pdf/static/description/screen_shot_xls_report_2.png b/project_report_pdf/static/description/screen_shot_xls_report_2.png new file mode 100644 index 000000000..7a4066297 Binary files /dev/null and b/project_report_pdf/static/description/screen_shot_xls_report_2.png differ diff --git a/project_report_pdf/views/project_report.xml b/project_report_pdf/views/project_report.xml new file mode 100644 index 000000000..76109a250 --- /dev/null +++ b/project_report_pdf/views/project_report.xml @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/project_report_pdf/views/project_report_button.xml b/project_report_pdf/views/project_report_button.xml new file mode 100644 index 000000000..bab2a6738 --- /dev/null +++ b/project_report_pdf/views/project_report_button.xml @@ -0,0 +1,15 @@ + + + + + project_report_pdf_inherited.form + project.project + + + +