Browse Source

Jul 24 : [UPDT] Bug Fixed 'manufacturing_reports'

pull/280/head
AjmalCybro 2 years ago
parent
commit
bcf5f792e4
  1. 33
      manufacturing_reports/README.rst
  2. 10
      manufacturing_reports/__init__.py
  3. 23
      manufacturing_reports/__manifest__.py
  4. 8
      manufacturing_reports/controllers/__init__.py
  5. 16
      manufacturing_reports/controllers/main.py
  6. 7
      manufacturing_reports/doc/RELEASE_NOTES.md
  7. 44
      manufacturing_reports/reports/mrp_report_template.xml
  8. 70
      manufacturing_reports/reports/mrp_report_templates.xml
  9. 3
      manufacturing_reports/reports/mrp_report_views.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. 52
      manufacturing_reports/static/description/index.html
  14. 26
      manufacturing_reports/static/src/js/action_manager.js
  15. 10
      manufacturing_reports/views/manufacturing_report_menus.xml
  16. 9
      manufacturing_reports/views/menu_items.xml
  17. 10
      manufacturing_reports/wizard/__init__.py
  18. 80
      manufacturing_reports/wizard/mrp_report.py
  19. 31
      manufacturing_reports/wizard/mrp_report_views.xml

33
manufacturing_reports/README.rst

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

10
manufacturing_reports/__init__.py

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

23
manufacturing_reports/__manifest__.py

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

8
manufacturing_reports/controllers/__init__.py

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

16
manufacturing_reports/controllers/main.py

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

7
manufacturing_reports/doc/RELEASE_NOTES.md

@ -3,4 +3,9 @@
#### 17.02.2023
#### Version 15.0.1.0.0
##### ADD
- Initial commit
- Initial commit for Manufacturing Reports
#### 10.07.2023
#### Version 15.0.1.0.0
#### UPDT
- Bug Fix for the xlsx report not printing issue in Manufacturing Reports

44
manufacturing_reports/reports/mrp_report_template.xml

@ -1,44 +0,0 @@
<?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

@ -0,0 +1,70 @@
<?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>

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

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

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

@ -1,3 +1,2 @@
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
1 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
2 access_mrp_report access.mrp.report model_mrp_report base.group_user 1 1 1 1

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 78 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 65 KiB

52
manufacturing_reports/static/description/index.html

@ -29,17 +29,14 @@
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Manufacturing Reports</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
PDF & XLS Reports For Manufacturing Module</p>
PDF & XLSX Reports For Manufacturing Module</p>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.png" class="img-responsive"
style="width: 100%; margin-left: auto; margin-right: auto;" />
</div>
</div>
</div>
</div>
<!-- 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 justify-content-center align-items-center mr-2"
@ -108,7 +105,7 @@
<div class="col-sm-12 py-4">
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
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.
</div>
</div>
@ -127,29 +124,29 @@
<div class="col-sm-12 col-md-6">
<div class="d-flex align-items-center" style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community Support</span>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Filter manufacturing orders by product.</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<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 based on Product
Filter manufacturing orders by start date.
</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Set start to print the orders from that date
Filter manufacturing orders by responsible person.
</span>
</div>
<div class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<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 class="d-flex align-items-center" style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2" />
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Enable filter based on the responsible person for production</span>
Compatible with Community, Enterprise and Odoo.sh.</span>
</div>
</div>
</div>
@ -180,21 +177,17 @@
Start Date and Responsible Person</p>
<img src="assets/screenshots/14_2.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
PDF report with images.</p>
<img src="assets/screenshots/14_3.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
XLS report
</p>
<img src="assets/screenshots/14_4.png" class="img-thumbnail">
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->
@ -272,8 +265,7 @@
class="carousel-control-prev-icon"><i class="fa fa-chevron-left"
style="font-size:24px"></i></span>
</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>
</div>
</div>
@ -281,7 +273,6 @@
<!-- END OF RELATED PRODUCTS -->
<!-- OUR SERVICES -->
<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"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
@ -290,7 +281,6 @@
<h2 class="mt-2" style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">Our Services
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
@ -302,7 +292,6 @@
Odoo
Customization</h6>
</div>
<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"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -312,7 +301,6 @@
Odoo
Implementation</h6>
</div>
<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"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -322,8 +310,6 @@
Odoo
Support</h6>
</div>
<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"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -334,7 +320,6 @@
Odoo
Developer</h6>
</div>
<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"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -344,7 +329,6 @@
Odoo
Integration</h6>
</div>
<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"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -354,8 +338,6 @@
Odoo
Migration</h6>
</div>
<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"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -365,7 +347,6 @@
Odoo
Consultancy</h6>
</div>
<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"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -375,7 +356,6 @@
Odoo
Implementation</h6>
</div>
<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"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -386,13 +366,10 @@
Licensing Consultancy</h6>
</div>
</div>
</div>
<!-- END OF END OF OUR SERVICES -->
<!-- END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<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"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
@ -402,7 +379,6 @@
Industries
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-3">
@ -418,7 +394,6 @@
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -432,7 +407,6 @@
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -445,7 +419,6 @@
educational management</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -458,7 +431,6 @@
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -472,7 +444,6 @@
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -485,7 +456,6 @@
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -498,7 +468,6 @@
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<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;">
@ -514,8 +483,7 @@
</div>
</div>
</div>
<!-- END OF END OF OUR INDUSTRIES -->
<!-- END OF OUR INDUSTRIES -->
<!-- SUPPORT -->
<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.define('manufacturing_reports .action_manager', function (require) {
"use strict";
/** @odoo-module */
import { registry } from "@web/core/registry";
import { download } from "@web/core/network/download";
import framework from 'web.framework';
import session from 'web.session';
/**
* The purpose of this file is to add the actions of type
* 'ir_actions_xlsx_download' to the ActionManager.
* @override
* Add 'xlsx' report type to the report handler
*/
var ActionManager = require('web.ActionManager');
var framework = require('web.framework');
var session = require('web.session');
ActionManager.include({
_executexlsxReportDownloadAction: function (action) {
registry.category("ir.actions.report handlers").add("xlsx", async (action) => {
if (action.report_type === 'xlsx') {
framework.blockUI();
var def = $.Deferred();
session.get_file({
@ -19,13 +19,5 @@ ActionManager.include({
complete: framework.unblockUI,
});
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/manufacturing_report_menus.xml

@ -0,0 +1,10 @@
<?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

@ -1,9 +0,0 @@
<?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/wizards/__init__.py → manufacturing_reports/wizard/__init__.py

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

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

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

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

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