Browse Source

Jul 24 : [UPDT] Bug Fixed 'manufacturing_reports'

pull/275/head
AjmalCybro 2 years ago
parent
commit
699443d7c8
  1. 33
      manufacturing_reports/README.rst
  2. 10
      manufacturing_reports/__init__.py
  3. 31
      manufacturing_reports/__manifest__.py
  4. 8
      manufacturing_reports/controllers/__init__.py
  5. 16
      manufacturing_reports/controllers/main.py
  6. 9
      manufacturing_reports/doc/RELEASE_NOTES.md
  7. 3
      manufacturing_reports/reports/mrp_report.xml
  8. 44
      manufacturing_reports/reports/mrp_report_template.xml
  9. 70
      manufacturing_reports/reports/mrp_report_templates.xml
  10. 1
      manufacturing_reports/security/ir.model.access.csv
  11. BIN
      manufacturing_reports/static/description/assets/screenshots/14_1.png
  12. BIN
      manufacturing_reports/static/description/assets/screenshots/14_2.png
  13. BIN
      manufacturing_reports/static/description/banner.png
  14. 52
      manufacturing_reports/static/description/index.html
  15. 26
      manufacturing_reports/static/src/js/action_manager.js
  16. 10
      manufacturing_reports/views/action_manager.xml
  17. 10
      manufacturing_reports/views/manufacturing_report_menus.xml
  18. 9
      manufacturing_reports/views/menu_items.xml
  19. 10
      manufacturing_reports/wizards/__init__.py
  20. 80
      manufacturing_reports/wizards/mrp_report_wizard.py
  21. 31
      manufacturing_reports/wizards/mrp_wizard_view.xml

33
manufacturing_reports/README.rst

@ -1,35 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg Invoice From Stock Picking
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html ==========================
:alt: License: AGPL-3 * Enables the option for creating invoice from stock picking
Manufacturing Reports
=====================
Provides an option to print XLSX and PDF report for the Manufacturing module.
Installation Installation
============ ============
- www.odoo.com/documentation/15.0/setup/install.html - www.odoo.com/documentation/14.0/setup/install.html
- Install our custom addon - Install our custom addon
Company License
------- -------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3)
(http://www.gnu.org/licenses/agpl.html)
License Company
------- -------
Affero General Public License v3.0 (AGPL v3) * `Cybrosys Techno Solutions <https://cybrosys.com/>`__
(https://www.gnu.org/licenses/agpl-3.0-standalone.html)
Credits Credits
------- -------
* Developer: (V9) Cybrosys Technologies. * Developer:
(V14) Javid A V14 Javid A
(V15) Javid A
Contacts Contacts
-------- --------
* Mail Contact : odoo@cybrosys.com * Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker Bug Tracker
----------- -----------
@ -37,12 +31,9 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you
Maintainer Maintainer
========== ==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies. This module is maintained by Cybrosys Technologies.
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ For support and more information, please visit https://www.cybrosys.com
Further information Further information
=================== ===================

10
manufacturing_reports/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,6 +18,6 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
from . import wizards
from . import controllers from . import controllers
from . import wizard

31
manufacturing_reports/__manifest__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,16 +18,13 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
{ {
'name': 'Manufacturing Reports', 'name': 'Manufacturing Reports',
'version': '15.0.1.0.0', 'version': '14.0.1.0.0',
'category': 'Manufacturing',
'summary': 'PDF & XLS Reports For Manufacturing Module', 'summary': 'PDF & XLS Reports For Manufacturing Module',
'description': """This module crafted by Cybrosys Technologies provides 'description': 'PDF & XLS reports for manufacturing module with advanced filters.',
an option to print PDF & XLS report for MRP systems, 'category': 'Manufacturing',
also you can view the product image in the report. This
works well for large and small business MRP systems.""",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'website': "http://www.cybrosys.com", 'website': "http://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
@ -35,16 +32,12 @@
'depends': ['base', 'mrp'], 'depends': ['base', 'mrp'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'reports/mrp_report_templates.xml', 'views/action_manager.xml',
'reports/mrp_report_views.xml', 'wizards/mrp_wizard_view.xml',
'wizard/mrp_report_views.xml', 'reports/mrp_report_template.xml',
'views/manufacturing_report_menus.xml', 'reports/mrp_report.xml',
'views/menu_items.xml',
], ],
'assets': {
'web.assets_backend': [
'manufacturing_reports/static/src/js/action_manager.js',
]
},
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],
'license': 'AGPL-3', 'license': 'AGPL-3',
'installable': True, 'installable': True,

8
manufacturing_reports/controllers/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,5 +18,5 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
from . import main from . import main

16
manufacturing_reports/controllers/main.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,7 +18,7 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
import json import json
from odoo import http from odoo import http
from odoo.http import content_disposition, request from odoo.http import content_disposition, request
@ -27,15 +27,11 @@ from odoo.tools import html_escape
class XLSXReportController(http.Controller): class XLSXReportController(http.Controller):
"""Class for the controller class XLSXReportController. @http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False)
Contains the function to print XLSX report.""" def get_report_xlsx(self, model, options, output_format, token, report_name, **kw):
@http.route('/xlsx_reports', type='http', auth='user', methods=['POST'],
csrf=False)
def get_report_xlsx(self, model, options, output_format, report_name):
uid = request.session.uid uid = request.session.uid
report_obj = request.env[model].with_user(uid) report_obj = request.env[model].with_user(uid)
options = json.loads(options) options = json.loads(options)
token = 'dummy-because-api-expects-one'
try: try:
if output_format == 'xlsx': if output_format == 'xlsx':
response = request.make_response( response = request.make_response(

9
manufacturing_reports/doc/RELEASE_NOTES.md

@ -1,11 +1,6 @@
## Module <manufacturing_reports> ## Module <manufacturing_reports>
#### 17.02.2023 #### 17.02.2023
#### Version 15.0.1.0.0 #### Version 14.0.1.0.0
##### ADD ##### ADD
- Initial commit for Manufacturing Reports - Initial commit
#### 10.07.2023
#### Version 15.0.1.0.0
#### UPDT
- Bug Fix for the xlsx report not printing issue in Manufacturing Reports

3
manufacturing_reports/reports/mrp_report_views.xml → manufacturing_reports/reports/mrp_report.xml

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<odoo> <odoo>
<!-- Manufacturing Report-->
<record id="action_mrp_report" model="ir.actions.report"> <record id="action_mrp_report" model="ir.actions.report">
<field name="name">Manufacturing Report</field> <field name="name">Manufacturing Report</field>
<field name="model">mrp.report</field> <field name="model">mrp.report</field>
@ -9,4 +9,5 @@
<field name="report_file">manufacturing_reports.report_mrp_order</field> <field name="report_file">manufacturing_reports.report_mrp_order</field>
<field name="binding_type">report</field> <field name="binding_type">report</field>
</record> </record>
</odoo> </odoo>

44
manufacturing_reports/reports/mrp_report_template.xml

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<odoo>
<template id="report_mrp_order">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h1><strong>MRP Order Report</strong></h1>
<t t-if="date_from"><p><strong>Date From : </strong>
<t t-esc="date_from"/></p></t>
<t t-if="stage"><p><strong>State : </strong>
<t t-esc="stage"/></p></t>
<table class="table table-sm table-striped mt-4">
<thead>
<tr>
<th>Reference</th>
<th>Image</th>
<th>Product</th>
<th>Quantity</th>
<th>Unit</th>
<th>Responsible</th>
<th>Start Date</th>
<th>State</th>
</tr>
</thead>
<tbody>
<tr t-foreach="mrp" t-as="rec">
<td><t t-esc="rec['name']"/></td>
<td> <img t-attf-src="data:image/png;base64,{{rec['image']}}" style="width:70%;" margin="right"/></td>
<td><t t-esc="rec['product']"/></td>
<td><t t-esc="rec['quantity']"/></td>
<td><t t-esc="rec['unit']"/></td>
<td><t t-esc="rec['responsible']"/></td>
<td><t t-esc="rec['start_date']"/></td>
<td><t t-esc="rec['state']"/></td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

70
manufacturing_reports/reports/mrp_report_templates.xml

@ -1,70 +0,0 @@
<?xml version="1.0"?>
<odoo>
<!-- Template for the manufacturing report.-->
<template id="report_mrp_order">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h1>
<strong>MRP Order Report</strong>
</h1>
<t t-if="date_from">
<p>
<strong>Date From :</strong>
<t t-esc="date_from"/>
</p>
</t>
<t t-if="stage">
<p>
<strong>State :</strong>
<t t-esc="stage"/>
</p>
</t>
<table class="table table-sm table-striped mt-4">
<thead>
<tr>
<th>Reference</th>
<th>Image</th>
<th>Product</th>
<th>Quantity</th>
<th>Unit</th>
<th>Responsible</th>
<th>Start Date</th>
<th>State</th>
</tr>
</thead>
<tbody>
<tr t-foreach="mrp" t-as="rec">
<td>
<t t-esc="rec['name']"/>
</td>
<td>
<img t-attf-src="data:image/png;base64,{{rec['image']}}"
style="width:70%;" margin="right"/>
</td>
<td>
<t t-esc="rec['product']"/>
</td>
<td>
<t t-esc="rec['quantity']"/>
</td>
<td>
<t t-esc="rec['unit']"/>
</td>
<td>
<t t-esc="rec['responsible']"/>
</td>
<td>
<t t-esc="rec['start_date']"/>
</td>
<td>
<t t-esc="rec['state']"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

1
manufacturing_reports/security/ir.model.access.csv

@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mrp_report,access.mrp.report,model_mrp_report,base.group_user,1,1,1,1 access_mrp_report,access.mrp.report,model_mrp_report,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_report access.mrp.report model_mrp_report base.group_user 1 1 1 1
3

BIN
manufacturing_reports/static/description/assets/screenshots/14_1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 114 KiB

BIN
manufacturing_reports/static/description/assets/screenshots/14_2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 97 KiB

BIN
manufacturing_reports/static/description/banner.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

52
manufacturing_reports/static/description/index.html

@ -29,14 +29,17 @@
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;"> <h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Manufacturing Reports</h1> Manufacturing Reports</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;"> <p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
PDF & XLSX Reports For Manufacturing Module</p> PDF & XLS Reports For Manufacturing Module</p>
<!-- END OF APP HERO --> <!-- END OF APP HERO -->
<img src="assets/screenshots/hero.png" class="img-responsive" <img src="assets/screenshots/hero.png" class="img-responsive"
style="width: 100%; margin-left: auto; margin-right: auto;" /> style="width: 100%; margin-left: auto; margin-right: auto;" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- NAVIGATION SECTION --> <!-- NAVIGATION SECTION -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;"> <div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;">
<div class="d-flex justify-content-center align-items-center mr-2" <div class="d-flex justify-content-center align-items-center mr-2"
@ -105,7 +108,7 @@
<div class="col-sm-12 py-4"> <div class="col-sm-12 py-4">
Manufacturing Reports is a free Cybrosys MRP software which helps to generate advanced Manufacturing Reports is a free Cybrosys MRP software which helps to generate advanced
report for MRP module(Material requirements planning).This allows both PDF & XLS report report for MRP module(Material requirements planning).This allows both PDF & XLS report
for MRP systems, also you can view the product image in the report. This works well for for MRP systems. Also you can view the product image in the report. This works well for
large and small business MRP systems. large and small business MRP systems.
</div> </div>
</div> </div>
@ -124,29 +127,29 @@
<div class="col-sm-12 col-md-6"> <div class="col-sm-12 col-md-6">
<div class="d-flex align-items-center" style="margin-top: 40px; margin-bottom: 40px"> <div class="d-flex align-items-center" style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2" /> <img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Filter manufacturing orders by product.</span> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community Support</span>
</div> </div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px"> <div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" /> <img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Filter manufacturing orders by start date. Filter manufacturing orders based on Product
</span> </span>
</div> </div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px"> <div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" /> <img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Filter manufacturing orders by responsible person. Set start to print the orders from that date
</span> </span>
</div> </div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px"> <div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" /> <img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Filter orders based on the status of the production.</span> Filter orders based on the status of the production</span>
</div> </div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px"> <div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" /> <img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Compatible with Community, Enterprise and Odoo.sh.</span> Enable filter based on the responsible person for production</span>
</div> </div>
</div> </div>
</div> </div>
@ -177,17 +180,21 @@
Start Date and Responsible Person</p> Start Date and Responsible Person</p>
<img src="assets/screenshots/14_2.png" class="img-thumbnail"> <img src="assets/screenshots/14_2.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"> <p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
PDF report with images.</p> PDF report with images.</p>
<img src="assets/screenshots/14_3.png" class="img-thumbnail"> <img src="assets/screenshots/14_3.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"> <p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
XLS report XLS report
</p> </p>
<img src="assets/screenshots/14_4.png" class="img-thumbnail"> <img src="assets/screenshots/14_4.png" class="img-thumbnail">
</div> </div>
</div> </div>
</div> </div>
<!-- END OF SCREENSHOTS SECTION --> <!-- END OF SCREENSHOTS SECTION -->
@ -265,7 +272,8 @@
class="carousel-control-prev-icon"><i class="fa fa-chevron-left" class="carousel-control-prev-icon"><i class="fa fa-chevron-left"
style="font-size:24px"></i></span> style="font-size:24px"></i></span>
</a> <a class="carousel-control-next" href="#demo1" data-slide="next" style="width:35px; color:#000"> </a> <a class="carousel-control-next" href="#demo1" data-slide="next" style="width:35px; color:#000">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right" style="font-size:24px"></i></span> <span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a> </a>
</div> </div>
</div> </div>
@ -273,6 +281,7 @@
<!-- END OF RELATED PRODUCTS --> <!-- END OF RELATED PRODUCTS -->
<!-- OUR SERVICES --> <!-- OUR SERVICES -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> <div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2" <div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
@ -281,6 +290,7 @@
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Our Services <h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Our Services
</h2> </h2>
</div> </div>
<div class="container my-5"> <div class="container my-5">
<div class="row"> <div class="row">
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
@ -292,6 +302,7 @@
Odoo Odoo
Customization</h6> Customization</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -301,6 +312,7 @@
Odoo Odoo
Implementation</h6> Implementation</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -310,6 +322,8 @@
Odoo Odoo
Support</h6> Support</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -320,6 +334,7 @@
Odoo Odoo
Developer</h6> Developer</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -329,6 +344,7 @@
Odoo Odoo
Integration</h6> Integration</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -338,6 +354,8 @@
Odoo Odoo
Migration</h6> Migration</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -347,6 +365,7 @@
Odoo Odoo
Consultancy</h6> Consultancy</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -356,6 +375,7 @@
Odoo Odoo
Implementation</h6> Implementation</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -366,10 +386,13 @@
Licensing Consultancy</h6> Licensing Consultancy</h6>
</div> </div>
</div> </div>
</div> </div>
<!-- END OF OUR SERVICES -->
<!-- END OF END OF OUR SERVICES -->
<!-- OUR INDUSTRIES --> <!-- OUR INDUSTRIES -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> <div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2" <div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
@ -379,6 +402,7 @@
Industries Industries
</h2> </h2>
</div> </div>
<div class="container my-5"> <div class="container my-5">
<div class="row"> <div class="row">
<div class="col-lg-3"> <div class="col-lg-3">
@ -394,6 +418,7 @@
sell your products</p> sell your products</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -407,6 +432,7 @@
and convivial experience</p> and convivial experience</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -419,6 +445,7 @@
educational management</p> educational management</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -431,6 +458,7 @@
schedule your operations</p> schedule your operations</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -444,6 +472,7 @@
awe-inspiring product pages</p> awe-inspiring product pages</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -456,6 +485,7 @@
services and invoice</p> services and invoice</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -468,6 +498,7 @@
restaurant methodically</p> restaurant methodically</p>
</div> </div>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center" <div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -483,7 +514,8 @@
</div> </div>
</div> </div>
</div> </div>
<!-- END OF OUR INDUSTRIES -->
<!-- END OF END OF OUR INDUSTRIES -->
<!-- SUPPORT --> <!-- SUPPORT -->
<div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> <div class="d-flex align-items-center" style="border-bottom: 2px solid #714B67; padding: 15px 0px;">

26
manufacturing_reports/static/src/js/action_manager.js

@ -1,14 +1,14 @@
/** @odoo-module */ odoo.define('manufacturing_reports .action_manager', function (require) {
import { registry } from "@web/core/registry"; "use strict";
import { download } from "@web/core/network/download";
import framework from 'web.framework';
import session from 'web.session';
/** /**
* @override * The purpose of this file is to add the actions of type
* Add 'xlsx' report type to the report handler * 'ir_actions_xlsx_download' to the ActionManager.
*/ */
registry.category("ir.actions.report handlers").add("xlsx", async (action) => { var ActionManager = require('web.ActionManager');
if (action.report_type === 'xlsx') { var framework = require('web.framework');
var session = require('web.session');
ActionManager.include({
_executexlsxReportDownloadAction: function (action) {
framework.blockUI(); framework.blockUI();
var def = $.Deferred(); var def = $.Deferred();
session.get_file({ session.get_file({
@ -19,5 +19,13 @@ registry.category("ir.actions.report handlers").add("xlsx", async (action) => {
complete: framework.unblockUI, complete: framework.unblockUI,
}); });
return def; return def;
},
_handleAction: function (action, options) {
if (action.report_type === 'xlsx') {
return this._executexlsxReportDownloadAction(action, options);
} }
return this._super.apply(this, arguments);
},
});
}); });

10
manufacturing_reports/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="manufacturing_reports/static/src/js/action_manager.js"/>
</xpath>
</template>
</data>
</odoo>

10
manufacturing_reports/views/manufacturing_report_menus.xml

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Menu for manufacturing report-->
<menuitem id="menu_mrp_reports"
parent="mrp.menu_mrp_reporting"
name="Manufacturing Reports"
action="manufacturing_reports.mrp_report_action"
sequence="5"/>
</odoo>

9
manufacturing_reports/views/menu_items.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<menuitem id="menu_mrp_reports" parent="mrp.menu_mrp_reporting" name="Manufacturing Reports"
action="mrp_wizard_action" sequence="5"/>
</data>
</odoo>

10
manufacturing_reports/wizard/__init__.py → manufacturing_reports/wizards/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,5 +18,5 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
from . import mrp_report from . import mrp_report_wizard

80
manufacturing_reports/wizard/mrp_report.py → manufacturing_reports/wizards/mrp_report_wizard.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### #############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Javid A (odoo@cybrosys.com) # Author: Javid A(<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
@ -18,7 +18,7 @@
# (AGPL v3) along with this program. # (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### #############################################################################
import io import io
import xlsxwriter import xlsxwriter
from odoo import fields, models from odoo import fields, models
@ -26,30 +26,18 @@ from odoo.tools import date_utils
from odoo.tools.safe_eval import json from odoo.tools.safe_eval import json
class MrpReport(models.TransientModel): class MrpReportWizard(models.Model):
"""Class for the transient model mrp report."""
_name = 'mrp.report' _name = 'mrp.report'
_description = 'MRP Report' _description = 'MRP Report'
filter = fields.Boolean(string='Enable filter by date', filter = fields.Boolean(string='Enable filter by date')
help='The reports can be filtered by date if ' date_from = fields.Date(string='Start Date')
'enabled.') filter_user = fields.Boolean(string='Filter On Responsible')
date_from = fields.Date(string='Start Date', responsible_id = fields.Many2many('res.users', string='Responsible')
help='Start date for the report data.') product_id = fields.Many2many('product.product', string='Product')
filter_user = fields.Boolean(string='Filter On Responsible',
help='The reports can be filtered by '
'responsible person, if enabled.')
responsible_id = fields.Many2many('res.users', string='Responsible',
help='Responsible person for the '
'records.')
product_id = fields.Many2many('product.product', string='Product',
help='Id of the product in the manufacturing'
' order.')
stage = fields.Selection( stage = fields.Selection(
[('confirmed', 'Confirmed'), ('planned', 'Planned'), [('confirmed', 'Confirmed'), ('planned', 'Planned'), ('progress', 'In Progress'),
('progress', 'In Progress'), ('done', 'Done'), ('cancel', 'Cancelled')], string="Filter State")
('done', 'Done'), ('cancel', 'Cancelled')], string="Filter State",
help='Stage of the manufacturing order.')
def check_report(self): def check_report(self):
""" """
@ -60,8 +48,7 @@ class MrpReport(models.TransientModel):
if self.product_id and self.stage and self.date_from and self.responsible_id: if self.product_id and self.stage and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
('state', '=', self.stage), ('state', '=', self.stage), ('date_planned_start', '>=', self.date_from),
('date_planned_start', '>=', self.date_from),
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.stage and self.date_from: elif self.product_id and self.stage and self.date_from:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
@ -71,8 +58,7 @@ class MrpReport(models.TransientModel):
elif self.product_id and self.stage and self.responsible_id: elif self.product_id and self.stage and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
('state', '=', self.stage), ('state', '=', self.stage), ('user_id', 'in', self.responsible_id.ids)])
('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.date_from and self.responsible_id: elif self.product_id and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
@ -80,13 +66,11 @@ class MrpReport(models.TransientModel):
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.stage and self.date_from and self.responsible_id: elif self.stage and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('state', '=', self.stage), [('state', '=', self.stage), ('date_planned_start', '>=', self.date_from),
('date_planned_start', '>=', self.date_from),
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.stage: elif self.product_id and self.stage:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids), ('state', '=', self.stage)])
('state', '=', self.stage)])
elif self.product_id and self.date_from: elif self.product_id and self.date_from:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
@ -101,8 +85,7 @@ class MrpReport(models.TransientModel):
('date_planned_start', '>=', self.date_from)]) ('date_planned_start', '>=', self.date_from)])
elif self.stage and self.responsible_id: elif self.stage and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('state', '=', self.stage), [('state', '=', self.stage), ('user_id', 'in', self.responsible_id.ids)])
('user_id', 'in', self.responsible_id.ids)])
elif self.date_from and self.responsible_id: elif self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('date_planned_start', '>=', self.date_from), [('date_planned_start', '>=', self.date_from),
@ -131,7 +114,6 @@ class MrpReport(models.TransientModel):
'start_date': rec.date_planned_start, 'start_date': rec.date_planned_start,
'state': rec.state, 'state': rec.state,
}) })
print('orders', orders)
data = { data = {
'date_from': self.date_from, 'date_from': self.date_from,
'stage': self.stage, 'stage': self.stage,
@ -156,19 +138,16 @@ class MrpReport(models.TransientModel):
if self.product_id and self.stage and self.date_from and self.responsible_id: if self.product_id and self.stage and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
('state', '=', self.stage), ('state', '=', self.stage), ('date_planned_start', '>=', self.date_from),
('date_planned_start', '>=', self.date_from),
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.stage and self.date_from: elif self.product_id and self.stage and self.date_from:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
('state', '=', self.stage), ('state', '=', self.stage), ('date_planned_start', '>=', self.date_from)])
('date_planned_start', '>=', self.date_from)])
elif self.product_id and self.stage and self.responsible_id: elif self.product_id and self.stage and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
('state', '=', self.stage), ('state', '=', self.stage), ('user_id', 'in', self.responsible_id.ids)])
('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.date_from and self.responsible_id: elif self.product_id and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
@ -176,13 +155,11 @@ class MrpReport(models.TransientModel):
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.stage and self.date_from and self.responsible_id: elif self.stage and self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('state', '=', self.stage), [('state', '=', self.stage), ('date_planned_start', '>=', self.date_from),
('date_planned_start', '>=', self.date_from),
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.product_id and self.stage: elif self.product_id and self.stage:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids), ('state', '=', self.stage)])
('state', '=', self.stage)])
elif self.product_id and self.date_from: elif self.product_id and self.date_from:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('product_id', 'in', self.product_id.ids), [('product_id', 'in', self.product_id.ids),
@ -193,12 +170,10 @@ class MrpReport(models.TransientModel):
('user_id', 'in', self.responsible_id.ids)]) ('user_id', 'in', self.responsible_id.ids)])
elif self.stage and self.date_from: elif self.stage and self.date_from:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('state', '=', self.stage), [('state', '=', self.stage), ('date_planned_start', '>=', self.date_from)])
('date_planned_start', '>=', self.date_from)])
elif self.stage and self.responsible_id: elif self.stage and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('state', '=', self.stage), [('state', '=', self.stage), ('user_id', 'in', self.responsible_id.ids)])
('user_id', 'in', self.responsible_id.ids)])
elif self.date_from and self.responsible_id: elif self.date_from and self.responsible_id:
mrp_orders = self.env['mrp.production'].search( mrp_orders = self.env['mrp.production'].search(
[('date_planned_start', '>=', self.date_from), [('date_planned_start', '>=', self.date_from),
@ -234,17 +209,14 @@ class MrpReport(models.TransientModel):
'mrp': orders 'mrp': orders
} }
return self.env.ref( return self.env.ref(
'manufacturing_reports.action_mrp_report').report_action(self, 'manufacturing_reports.action_mrp_report').report_action(self, data=data)
data=data)
def get_xlsx_report(self, data, response): def get_xlsx_report(self, data, response):
print('get_xlsx_report(self, data, response)')
output = io.BytesIO() output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) workbook = xlsxwriter.Workbook(output, {'in_memory': True})
sheet = workbook.add_worksheet() sheet = workbook.add_worksheet()
cell_format = workbook.add_format({'font_size': '12px', 'bold': True}) cell_format = workbook.add_format({'font_size': '12px', 'bold': True})
head = workbook.add_format( head = workbook.add_format({'align': 'center', 'bold': True, 'font_size': '20px'})
{'align': 'center', 'bold': True, 'font_size': '20px'})
txt_head = workbook.add_format({'font_size': '12px'}) txt_head = workbook.add_format({'font_size': '12px'})
sheet.set_column('B:B', 15) sheet.set_column('B:B', 15)
sheet.set_column('C:C', 15) sheet.set_column('C:C', 15)

31
manufacturing_reports/wizard/mrp_report_views.xml → manufacturing_reports/wizards/mrp_wizard_view.xml

@ -1,8 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<!-- Form view for mrp.report-->
<record id="mrp_report_view_form" model="ir.ui.view"> <record id="mrp_wizard_action" model="ir.actions.act_window">
<field name="name">mrp.report.view.form</field> <field name="name">MRP Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.report</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="mrp_wizard_view" model="ir.ui.view">
<field name="name">MRP Report</field>
<field name="model">mrp.report</field> <field name="model">mrp.report</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="MRP Report"> <form string="MRP Report">
@ -21,23 +29,14 @@
</group> </group>
</group> </group>
<footer> <footer>
<button name="check_report" string="Export xls" <button name="check_report" string="Export xls" type="object" class="oe_highlight" icon='fa-download'/>
type="object" class="oe_highlight" <button name="print_pdf" string="Print Pdf" type="object" class="oe_highlight" icon='fa-download'/>
icon='fa-download'/>
<button name="print_pdf" string="Print Pdf" type="object"
class="oe_highlight" icon='fa-download'/>
or or
<button string="Cancel" class="oe_link" special="cancel"/> <button string="Cancel" class="oe_link" special="cancel"/>
</footer> </footer>
</form> </form>
</field> </field>
</record> </record>
<!-- Action for the mrp.report-->
<record id="mrp_report_action" model="ir.actions.act_window">
<field name="name">MRP Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.report</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo> </odoo>
Loading…
Cancel
Save