Browse Source

[ADD] Initial Commit 'project_report_pdf'

pull/134/merge
Ajmalcybrosys 6 years ago
parent
commit
c63f4bdc28
  1. 22
      project_report_pdf/README.rst
  2. 25
      project_report_pdf/__init__.py
  3. 42
      project_report_pdf/__manifest__.py
  4. 1
      project_report_pdf/controllers/__init__.py
  5. 36
      project_report_pdf/controllers/main.py
  6. 7
      project_report_pdf/doc/RELEASE_NOTES.md
  7. 22
      project_report_pdf/report/__init__.py
  8. 80
      project_report_pdf/report/project_report_pdf.py
  9. 44
      project_report_pdf/report/project_report_pdf_view.xml
  10. BIN
      project_report_pdf/static/description/banner.png
  11. BIN
      project_report_pdf/static/description/cybro_logo.png
  12. BIN
      project_report_pdf/static/description/icon.png
  13. 355
      project_report_pdf/static/description/index.html
  14. BIN
      project_report_pdf/static/description/project-report-cybrosys-1.png
  15. BIN
      project_report_pdf/static/description/project-report-cybrosys-2.png
  16. BIN
      project_report_pdf/static/description/project-report-cybrosys-3.png
  17. BIN
      project_report_pdf/static/description/project-report-cybrosys-4.png
  18. 48
      project_report_pdf/static/src/js/action_manager.js
  19. 10
      project_report_pdf/views/action_manager.xml
  20. 15
      project_report_pdf/views/project_report.xml
  21. 16
      project_report_pdf/views/project_report_button.xml
  22. 22
      project_report_pdf/wizard/__init__.py
  23. 174
      project_report_pdf/wizard/project_report_wizard.py
  24. 36
      project_report_pdf/wizard/project_report_wizard_view.xml

22
project_report_pdf/README.rst

@ -0,0 +1,22 @@
Project Report v13
==================
PDF and XLS Reports for Project Module.
Features
========
* Project Task Report XLS [With advanced Filtration]
* Project Task Report PDF [With advanced Filtration]
Credits
=======
Cybrosys Techno Solutions <www.cybrosys.com>
Author
------
* Developer v9: Avinash Nk @ cybrosys
* Developer v10: Treesa @ cybrosys
* Developer V11: Akshay @ cybrosys
* Developer V12: Akshay @ cybrosys
* Developer V13: Vinaya S B @ cybrosys

25
project_report_pdf/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Akshay Babu(<https://www.cybrosys.com>)
#
# 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 wizard
from . import controllers
from . import report

42
project_report_pdf/__manifest__.py

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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': 'Project Report XLS & PDF',
'version': '13.0.1.0.0',
"category": "Project",
'author': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'maintainer': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'summary': """Advanced PDF & XLS Reports for Project With Filtrations""",
'description': """Advanced PDF & XLS Reports for Project With Filtrations, Odoo 13, Odoo13""",
'depends': ['base', 'project'],
'license': 'AGPL-3',
'data': ['views/action_manager.xml',
'wizard/project_report_wizard_view.xml',
'report/project_report_pdf_view.xml',
'views/project_report_button.xml',
'views/project_report.xml'
],
'images': ['static/description/banner.png'],
'installable': True,
'auto_install': False,
}

1
project_report_pdf/controllers/__init__.py

@ -0,0 +1 @@
from . import main

36
project_report_pdf/controllers/main.py

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
import json
from odoo import http
from odoo.http import content_disposition, request
from odoo.addons.web.controllers.main import _serialize_exception
from odoo.tools import html_escape
class XLSXReportController(http.Controller):
@http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False)
def get_report_xlsx(self, model, options, output_format, token, report_name, **kw):
uid = request.session.uid
report_obj = request.env[model].with_user(uid)
options = json.loads(options)
try:
if output_format == 'xlsx':
response = request.make_response(
None,
headers=[
('Content-Type', 'application/vnd.ms-excel'),
('Content-Disposition', content_disposition(report_name + '.xlsx'))
]
)
report_obj.get_xlsx_report(options, response)
response.set_cookie('fileToken', token)
return response
except Exception as e:
se = _serialize_exception(e)
error = {
'code': 200,
'message': 'Odoo Server Error',
'data': se
}
return request.make_response(html_escape(json.dumps(error)))

7
project_report_pdf/doc/RELEASE_NOTES.md

@ -0,0 +1,7 @@
## Module <project_report_pdf>
#### 2.11.2019
#### Version 13.0.1.0.0
##### ADD
- Initial commit for project_report_pdf

22
project_report_pdf/report/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Akshay Babu(<https://www.cybrosys.com>)
#
# 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 project_report_pdf

80
project_report_pdf/report/project_report_pdf.py

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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.http import request
from odoo import models, api
class ProjectReportParser(models.AbstractModel):
_name = 'report.project_report_pdf.project_report_template'
def _get_report_values(self, docids, data=None):
name = data['record']
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 wizard_record.partner_select:
if wizard_record.stage_select:
current_task = task_obj.search([('project_id', '=', name),
('user_id', 'in', users_selected),
('stage_id', 'in', stages_selected)])
else:
current_task = task_obj.search([('project_id', '=', name),
('user_id', 'in', users_selected)])
else:
if wizard_record.stage_select:
current_task = task_obj.search([('project_id', '=', name),
('stage_id', 'in', stages_selected)])
else:
current_task = task_obj.search([('project_id', '=', name)])
vals = []
for i in current_task:
vals.append({
'name': i.name,
'user_id': i.user_id.name,
'stage_id': i.stage_id.name,
})
if current_task:
return {
'vals': vals,
'name': current_task[0].project_id.name,
'manager': current_task[0].project_id.user_id.name,
'date_start': current_task[0].project_id.date_start,
'date_end': current_task[0].project_id.date,
}
else:
return {
'vals': vals,
'name': current_task.project_id.name,
'manager': current_task.project_id.user_id.name,
'date_start': current_task.project_id.date_start,
'date_end': current_task.project_id.date,
}

44
project_report_pdf/report/project_report_pdf_view.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="project_report_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page" >
<br/>
<div style="text-align:left;color:black!important;"><strong><h1>Project :<span t-esc="name"/></h1></strong></div>
<div style="text-align:left;color:black!important;"><strong><p>Project Manager:<span t-esc="manager"/></p></strong></div>
<div style="text-align:left;color:black!important;"><strong><p>Start Date:<span t-esc="date_start"/></p></strong></div>
<div style="text-align:left;color:black!important;"><strong><p>End Date:<span t-esc="date_end"/></p></strong></div>
<div style="text-align:left;color:black!important;"><strong><h1>Open Tasks</h1></strong></div>
<table class="table table-condensed">
<thead>
<tr >
<th style="text-align:left;color:black!important;">Task</th>
<th style="text-align:left;color:black!important;">Assigned</th>
<th style="text-align:left;color:black!important;">Stage</th>
</tr>
</thead>
<tbody>
<t t-foreach="vals" t-as="doc">
<tr>
<td>
<span t-att-style="style" t-esc="doc['name']"/>
</td>
<td>
<span t-att-style="style" t-esc="doc['user_id']"/>
</td>
<td>
<span t-att-style="style" t-esc="doc['stage_id']"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

BIN
project_report_pdf/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
project_report_pdf/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
project_report_pdf/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

355
project_report_pdf/static/description/index.html

@ -0,0 +1,355 @@
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-header-banner.png);background-repeat:no-repeat;background-size:100%;padding: 4% 0% 2% 15%;background-position-y: -107px;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="font-size: 35px;color: #fff;font-weight: 900;text-transform: uppercase;text-align: left;margin: 0;margin-bottom: 16px;">
Project Report PDF & XLS
</h2>
<h5 class="oe_slogan" style="text-align: left;background: #fff;width: 293px;padding: 10px;color: #080808 !important;opacity: 1 !important;font-weight: 600;font-size: 20px;">
<a style="color: #080808 !important;" href="https://www.cybrosys.com" target="_blank">Cybrosys Technologies</a>
</h5>
<a style="color: #080808 !important;" href="https://www.cybrosys.com" target="_blank">
<div style="width: 215px;margin-left: 57%;text-align: center;background: #ffffff;height: 215px;border-radius: 100%;display: flex;justify-content: center;align-items: center;box-shadow: 0 0 12px 4px #00000059;">
<img src="https://www.cybrosys.com/images/cybro-logo-oca.png" alt="cybrosys technologies" style="width: 180px;"/>
</div>
</a>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 3% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Overview
</h2>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
This module enhances the project management with intuitive reports.
Reports consist of task details with respect to the selected project.
The user can use the filter facilities from report wizard to get the optimized reports.
</h3>
</div>
</section>
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-banner1.png); background-repeat:no-repeat; background-size:cover;padding: 2% 0% 11% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Features
</h2>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
PDF Reports in Project.
</h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
XLS Reports in Project.
</h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
Detailed Report on Tasks.
</h3>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 18px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
Advanced Filters for Report.
</h3>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 0% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Screenshots
</h2>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
Go to Project -> Project
</h3>
<div class="oe_row oe_spaced">
<img src="project-report-cybrosys-1.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
You can filter the project report via selecting the appropriate options from the wizard.
</h3>
<div class="oe_row oe_spaced">
<img src="project-report-cybrosys-2.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
PDF Report Of Data Import/Export Plugin Project.
</h3>
<div class="oe_row oe_spaced">
<img src="project-report-cybrosys-3.png" alt="" style="width: 95%;"/>
</div>
<h3 class="oe_slogan" style="text-align: left;padding: 5% 0% 0% 0%;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
<img src="https://www.cybrosys.com/images/ico-tick.png">
Excel Report Of Data Import/Export Plugin Project.
</h3>
<div class="oe_row oe_spaced">
<img src="project-report-cybrosys-4.png" alt="" style="width: 95%;"/>
</div>
</div>
</section>
<section class="oe_container" style="padding: 7px 0% 0% 3%;">
<div class="oe_row oe_spaced">
<a style="color: #080808 !important;" href="https://apps.odoo.com/apps/modules/browse?search=cybrosys" target="_blank"><img src="https://www.cybrosys.com/images/view-more-apps.jpg" alt="cybrosys technologies" style="width: 100%;margin-bottom: 50px;"/></a>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Services
</h2>
<div style="display:flex;padding-top: 20px;justify-content: space-between;">
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-customization.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/" target="_blank">
Odoo Customization
</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-implementation.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
Odoo Implementation </a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-integration.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank">
Odoo Integration
</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-support.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank">
Odoo Support</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank">
<img src="https://www.cybrosys.com/images/hire-odoo-developer.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank">
Hire Odoo Developers</a>
</h3>
</a>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Industries
</h2>
<div style="display:flex;justify-content: space-between;flex-wrap:wrap;">
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-1.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/" target="_blank">
Trading
</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easily procure and sell your products.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-2.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/" target="_blank">
Manufacturing</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Plan, track and schedule your operations.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-3.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/" target="_blank">
Restaurant</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Run your bar or restaurant methodical.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-4.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
POS</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easy configuring and convivial selling.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-5.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 0px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/" target="_blank">
E-commerce & Website</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Mobile friendly, awe-inspiring product pages.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-6.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/" target="_blank">
Hotel Management</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
An all-inclusive hotel management application.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-7.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/" target="_blank">
Education</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
A Collaborative platform for educational management.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-8.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/" target="_blank">
Service Management</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Keep track of services and invoice accordingly.
</h3>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-footer-bg.png); background-repeat:no-repeat; background-size:100%;padding: 13% 0% 6% 0%;">
<div class="oe_slogan" style="margin-top:10px !important;margin-bottom: 0px;">
<div>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="mailto:odoo@cybrosys.com"><i class="fa fa-envelope"></i> Email us </a>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" 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 style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com/contact/"><i class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="https://www.cybrosys.com/images/logo.png" style="width: 190px; margin-bottom: 25px;margin-top: 30px;" 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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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; ;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></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;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
</div>
</div>
</section>

BIN
project_report_pdf/static/description/project-report-cybrosys-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
project_report_pdf/static/description/project-report-cybrosys-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
project_report_pdf/static/description/project-report-cybrosys-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

BIN
project_report_pdf/static/description/project-report-cybrosys-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

48
project_report_pdf/static/src/js/action_manager.js

@ -0,0 +1,48 @@
odoo.define('project_report_pdf.action_manager', function (require) {
"use strict";
/**
* The purpose of this file is to add the actions of type
* 'ir_actions_xlsx_download' to the ActionManager.
*/
var ActionManager = require('web.ActionManager');
var framework = require('web.framework');
var session = require('web.session');
ActionManager.include({
/**
* Executes actions of type 'ir_actions_xlsx_download'.
*
* @private
* @param {Object} action the description of the action to execute
* @returns {Deferred} resolved when the report has been downloaded ;
* rejected if an error occurred during the report generation
*/
_executexlsxReportDownloadAction: function (action) {
framework.blockUI();
var def = $.Deferred();
session.get_file({
url: '/xlsx_reports',
data: action.data,
success: def.resolve.bind(def),
complete: framework.unblockUI,
});
return def;
},
/**
* Overrides to handle the 'ir_actions_xlsx_download' actions.
*
* @override
* @private
*/
_handleAction: function (action, options) {
if (action.type === 'ir_actions_xlsx_download') {
return this._executexlsxReportDownloadAction(action, options);
}
return this._super.apply(this, arguments);
},
});
});

10
project_report_pdf/views/action_manager.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_backend" name="xls_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/project_report_pdf/static/src/js/action_manager.js"/>
</xpath>
</template>
</data>
</odoo>

15
project_report_pdf/views/project_report.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<report
id="report_project_pdf"
string="Project PDF Report"
model="project.project"
report_type="qweb-pdf"
file="project_report_pdf.project_report_template"
name="project_report_pdf.project_report_template"
menu = "False"
/>
</data>
</odoo>

16
project_report_pdf/views/project_report_button.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="project_report_pdf_inherited" model="ir.ui.view">
<field name="name">project_report_pdf_inherited.form</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='%(portal.portal_share_action)d']" position="after">
<button name="%(project_report_pdf.project_report_open_wizard)d" type="action" string="Print" class="oe_highlight"/>
</xpath>
</field>
</record>
</data>
</odoo>

22
project_report_pdf/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Akshay Babu(<https://www.cybrosys.com>)
#
# 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 project_report_wizard

174
project_report_pdf/wizard/project_report_wizard.py

@ -0,0 +1,174 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
from datetime import datetime
import json
import datetime
import pytz
import io
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from odoo.http import request
from odoo.tools import date_utils
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
import xlsxwriter
class ProjectReportButton(models.TransientModel):
_name = 'wizard.project.report'
partner_select = fields.Many2many('res.users', string='Assigned to')
stage_select = fields.Many2many('project.task.type', string="Stage")
def print_project_report_pdf(self):
active_record = self._context['active_id']
record = self.env['project.project'].browse(active_record)
data = {
'ids': self.ids,
'model': self._name,
'record': record.id,
'partner_select': self.partner_select
}
return self.env.ref('project_report_pdf.report_project_pdf').report_action(self, data=data)
def print_project_report_xls(self):
active_record = self._context['active_id']
record = self.env['project.project'].browse(active_record)
data = {
'ids': self.ids,
'model': self._name,
'record': record.id,
}
return {
'type': 'ir_actions_xlsx_download',
'data': {'model': 'wizard.project.report',
'options': json.dumps(data, default=date_utils.json_default),
'output_format': 'xlsx',
'report_name': 'Project Report',
}
}
def get_xlsx_report(self, data, response):
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': True})
name = data['record']
user_obj = self.env.user
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 wizard_record.partner_select:
if wizard_record.stage_select:
current_task = task_obj.search([('project_id', '=', name),
('user_id', 'in', users_selected),
('stage_id', 'in', stages_selected)])
else:
current_task = task_obj.search([('project_id', '=', name),
('user_id', 'in', users_selected)])
else:
if wizard_record.stage_select:
current_task = task_obj.search([('project_id', '=', name),
('stage_id', 'in', stages_selected)])
else:
current_task = task_obj.search([('project_id', '=', name)])
vals = []
for i in current_task:
vals.append({
'name': i.name,
'user_id': i.user_id.name if i.user_id.name else '',
'stage_id': i.stage_id.name,
})
if current_task:
project_name = current_task[0].project_id.name
user = current_task[0].project_id.user_id.name
else:
project_name = current_task.project_id.name
user = current_task.project_id.user_id.name
sheet = workbook.add_worksheet("Project Report")
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'})
format7.set_align('center')
sheet.merge_range('A1:B1', user_obj.company_id.name, format5)
sheet.merge_range('A2:B2', user_obj.company_id.street, format5)
sheet.write('A3', user_obj.company_id.city, format5)
sheet.write('B3', user_obj.company_id.zip, format5)
sheet.merge_range('A4:B4', user_obj.company_id.state_id.name, format5)
sheet.merge_range('A5:B5', user_obj.company_id.country_id.name, format5)
sheet.merge_range('C1:H5', "", format5)
sheet.merge_range(5, 0, 6, 1, "Project :", format1)
if project_name:
sheet.merge_range(5, 2, 6, 7, project_name, format1)
sheet.merge_range('A8:B8', "Project Manager :", format5)
if user:
sheet.merge_range('C8:D8', user, format5)
date_start = ''
date_end = ''
if current_task:
date_start = str(current_task[0].project_id.date_start)
if current_task:
date_end = str(current_task[0].project_id.date)
sheet.merge_range('A9:B9', "Start Date :", format5)
if not date_start:
sheet.merge_range('C9:D9', '', format5)
else:
sheet.merge_range('C9:D9', date_start, format5)
sheet.merge_range('A10:B10', "End Date :", format5)
if str(date_end):
sheet.merge_range('C10:D10', date_end, format5)
sheet.merge_range(0, 2, 4, 5, "", format5)
sheet.merge_range(1, 6, 4, 7, "", format5)
sheet.merge_range(7, 4, 9, 7, "", format5)
sheet.merge_range(10, 4, 11, 7, "", format5)
sheet.merge_range('A11:H12', 'Open Tasks', format4)
sheet.merge_range('A13:D13', "Tasks", format2)
sheet.merge_range('E13:F13', "Assigned", format2)
sheet.merge_range('G13:H13', "Stage", format2)
row_number = 13
column_number = 0
for val in vals:
sheet.merge_range(row_number, column_number, row_number, column_number + 3, val['name'], format3)
sheet.merge_range(row_number, column_number + 4, row_number, column_number + 5, val['user_id'], format3)
sheet.merge_range(row_number, column_number + 6, row_number, column_number + 7, val['stage_id'], format3)
row_number += 1
row_number += 1
sheet.merge_range(row_number, 0, row_number, 1, user_obj.company_id.phone, format7)
sheet.merge_range(row_number, 2, row_number, 4, user_obj.company_id.email, format7)
sheet.merge_range(row_number, 5, row_number, 7, user_obj.company_id.website, format7)
workbook.close()
output.seek(0)
response.stream.write(output.read())
output.close()

36
project_report_pdf/wizard/project_report_wizard_view.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="report_wizard_view_form" model="ir.ui.view">
<field name="name">report_wizard_view_form.form</field>
<field name="model">wizard.project.report</field>
<field name="arch" type="xml">
<form string="Select period">
<group>
<group >
<field name="partner_select" widget="many2many_tags"/>
</group>
<group >
<field name="stage_select" widget="many2many_tags"/>
</group>
</group>
<footer>
<button name="print_project_report_pdf" type="object" string="Print PDF" class="oe_highlight"/>
<button name="print_project_report_xls" type="object" string="Print XLS" class="oe_highlight"/>
<button special="cancel" string="Cancel"/>
</footer>
</form>
</field>
</record>
<act_window
id="project_report_open_wizard"
name="Project Report"
res_model="wizard.project.report"
view_mode="form"
view_id="report_wizard_view_form"
target="new"/>
</data>
</odoo>
Loading…
Cancel
Save