diff --git a/manufacturing_reports/README.rst b/manufacturing_reports/README.rst index 2b74859ff..a19ae24d8 100644 --- a/manufacturing_reports/README.rst +++ b/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 `__ +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,10 +37,13 @@ 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 `__ Further information =================== -HTML Description: ``__ +HTML Description: ``__ \ No newline at end of file diff --git a/manufacturing_reports/__init__.py b/manufacturing_reports/__init__.py index dc6987a52..756356f89 100644 --- a/manufacturing_reports/__init__.py +++ b/manufacturing_reports/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# -from . import wizards +############################################################################### from . import controllers +from . import wizard diff --git a/manufacturing_reports/__manifest__.py b/manufacturing_reports/__manifest__.py index 504635e4c..fa53c0262 100644 --- a/manufacturing_reports/__manifest__.py +++ b/manufacturing_reports/__manifest__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# +############################################################################### { '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': [ diff --git a/manufacturing_reports/controllers/__init__.py b/manufacturing_reports/controllers/__init__.py index ae3ce9c0d..5e45e82c9 100644 --- a/manufacturing_reports/controllers/__init__.py +++ b/manufacturing_reports/controllers/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# +############################################################################### from . import main diff --git a/manufacturing_reports/controllers/main.py b/manufacturing_reports/controllers/main.py index 0c3902cc3..9de857ff8 100644 --- a/manufacturing_reports/controllers/main.py +++ b/manufacturing_reports/controllers/main.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# +############################################################################### 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( diff --git a/manufacturing_reports/doc/RELEASE_NOTES.md b/manufacturing_reports/doc/RELEASE_NOTES.md index 8ec527909..9cd0835d9 100644 --- a/manufacturing_reports/doc/RELEASE_NOTES.md +++ b/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 \ No newline at end of file diff --git a/manufacturing_reports/reports/mrp_report_template.xml b/manufacturing_reports/reports/mrp_report_template.xml deleted file mode 100644 index 8e00e5211..000000000 --- a/manufacturing_reports/reports/mrp_report_template.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/manufacturing_reports/reports/mrp_report_templates.xml b/manufacturing_reports/reports/mrp_report_templates.xml new file mode 100644 index 000000000..d4f09ddd7 --- /dev/null +++ b/manufacturing_reports/reports/mrp_report_templates.xml @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/manufacturing_reports/reports/mrp_report.xml b/manufacturing_reports/reports/mrp_report_views.xml similarity index 91% rename from manufacturing_reports/reports/mrp_report.xml rename to manufacturing_reports/reports/mrp_report_views.xml index ca8905da3..2c743c0d4 100644 --- a/manufacturing_reports/reports/mrp_report.xml +++ b/manufacturing_reports/reports/mrp_report_views.xml @@ -1,6 +1,6 @@ - + Manufacturing Report mrp.report @@ -9,5 +9,4 @@ manufacturing_reports.report_mrp_order report - \ No newline at end of file diff --git a/manufacturing_reports/security/ir.model.access.csv b/manufacturing_reports/security/ir.model.access.csv index fb7bc75fe..a21f91726 100644 --- a/manufacturing_reports/security/ir.model.access.csv +++ b/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 \ No newline at end of file +access_mrp_report,access.mrp.report,model_mrp_report,base.group_user,1,1,1,1 diff --git a/manufacturing_reports/static/description/assets/screenshots/14_1.png b/manufacturing_reports/static/description/assets/screenshots/14_1.png index 87bf1c657..e3e6d92ab 100644 Binary files a/manufacturing_reports/static/description/assets/screenshots/14_1.png and b/manufacturing_reports/static/description/assets/screenshots/14_1.png differ diff --git a/manufacturing_reports/static/description/assets/screenshots/14_2.png b/manufacturing_reports/static/description/assets/screenshots/14_2.png index 9ed7395ef..26cfd50cf 100644 Binary files a/manufacturing_reports/static/description/assets/screenshots/14_2.png and b/manufacturing_reports/static/description/assets/screenshots/14_2.png differ diff --git a/manufacturing_reports/static/description/index.html b/manufacturing_reports/static/description/index.html index 46a90839b..94e74026b 100644 --- a/manufacturing_reports/static/description/index.html +++ b/manufacturing_reports/static/description/index.html @@ -29,17 +29,14 @@

Manufacturing Reports

- PDF & XLS Reports For Manufacturing Module

+ PDF & XLSX Reports For Manufacturing Module

- - -
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.
@@ -127,29 +124,29 @@
- Community Support + Filter manufacturing orders by product.
- Filter manufacturing orders based on Product + Filter manufacturing orders by start date.
- Set start to print the orders from that date + Filter manufacturing orders by responsible person.
- Filter orders based on the status of the production + Filter orders based on the status of the production.
- Enable filter based on the responsible person for production + Compatible with Community, Enterprise and Odoo.sh.
@@ -180,21 +177,17 @@ Start Date and Responsible Person

-

PDF report with images.

-

XLS report

- - @@ -272,8 +265,7 @@ class="carousel-control-prev-icon"> - + @@ -281,7 +273,6 @@ -
@@ -290,7 +281,6 @@

Our Services

-
@@ -302,7 +292,6 @@ Odoo Customization
-
@@ -312,7 +301,6 @@ Odoo Implementation
-
@@ -322,8 +310,6 @@ Odoo Support
- -
@@ -334,7 +320,6 @@ Odoo Developer
-
@@ -344,7 +329,6 @@ Odoo Integration
-
@@ -354,8 +338,6 @@ Odoo Migration
- -
@@ -365,7 +347,6 @@ Odoo Consultancy
-
@@ -375,7 +356,6 @@ Odoo Implementation
-
@@ -386,13 +366,10 @@ Licensing Consultancy
-
- - + -
@@ -402,7 +379,6 @@ Industries
-
@@ -418,7 +394,6 @@ sell your products

-
@@ -432,7 +407,6 @@ and convivial experience

-
@@ -445,7 +419,6 @@ educational management

-
@@ -458,7 +431,6 @@ schedule your operations

-
@@ -472,7 +444,6 @@ awe-inspiring product pages

-
@@ -485,7 +456,6 @@ services and invoice

-
@@ -498,7 +468,6 @@ restaurant methodically

-
@@ -514,8 +483,7 @@
- - +
diff --git a/manufacturing_reports/static/src/js/action_manager.js b/manufacturing_reports/static/src/js/action_manager.js index 5663b890f..2503b9eed 100644 --- a/manufacturing_reports/static/src/js/action_manager.js +++ b/manufacturing_reports/static/src/js/action_manager.js @@ -1,31 +1,23 @@ -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) { - framework.blockUI(); - var def = $.Deferred(); - session.get_file({ - url: '/xlsx_reports', - data: action.data, - success: def.resolve.bind(def), - error: (error) => this.call('crash_manager', 'rpc_error', error), - 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); - -}, - }); - }); \ No newline at end of file +registry.category("ir.actions.report handlers").add("xlsx", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); \ No newline at end of file diff --git a/manufacturing_reports/views/manufacturing_report_menus.xml b/manufacturing_reports/views/manufacturing_report_menus.xml new file mode 100644 index 000000000..4d4f3945c --- /dev/null +++ b/manufacturing_reports/views/manufacturing_report_menus.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/manufacturing_reports/views/menu_items.xml b/manufacturing_reports/views/menu_items.xml deleted file mode 100644 index b08ba7a3e..000000000 --- a/manufacturing_reports/views/menu_items.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/manufacturing_reports/wizards/__init__.py b/manufacturing_reports/wizard/__init__.py similarity index 86% rename from manufacturing_reports/wizards/__init__.py rename to manufacturing_reports/wizard/__init__.py index 636f7d40d..bf0d2cfd6 100644 --- a/manufacturing_reports/wizards/__init__.py +++ b/manufacturing_reports/wizard/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# -from . import mrp_report_wizard +############################################################################### +from . import mrp_report diff --git a/manufacturing_reports/wizards/mrp_report_wizard.py b/manufacturing_reports/wizard/mrp_report.py similarity index 75% rename from manufacturing_reports/wizards/mrp_report_wizard.py rename to manufacturing_reports/wizard/mrp_report.py index 131e9486b..3bb83bd90 100644 --- a/manufacturing_reports/wizards/mrp_report_wizard.py +++ b/manufacturing_reports/wizard/mrp_report.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). -# Author: Javid A() +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# 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 . # -############################################################################# +############################################################################### 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) @@ -236,21 +264,21 @@ class MrpReportWizard(models.Model): row = 9 col = 2 sheet.write(row, col, 'Reference', cell_format) - sheet.write(row, col+1, 'Product', cell_format) - sheet.write(row, col+2, 'Quantity', cell_format) - sheet.write(row, col+3, 'Unit', cell_format) - sheet.write(row, col+4, 'Responsible', cell_format) - sheet.write(row, col+5, 'Start Date', cell_format) - sheet.write(row, col+6, 'State', cell_format) + sheet.write(row, col + 1, 'Product', cell_format) + sheet.write(row, col + 2, 'Quantity', cell_format) + sheet.write(row, col + 3, 'Unit', cell_format) + sheet.write(row, col + 4, 'Responsible', cell_format) + sheet.write(row, col + 5, 'Start Date', cell_format) + sheet.write(row, col + 6, 'State', cell_format) for rec in data['mrp']: row += 1 sheet.write(row, col, rec['name']) - sheet.write(row, col+1, rec['product']) - sheet.write(row, col+2, rec['quantity']) - sheet.write(row, col+3, rec['unit']) - sheet.write(row, col+4, rec['responsible']) - sheet.write(row, col+5, rec['start_date']) - sheet.write(row, col+6, rec['state']) + sheet.write(row, col + 1, rec['product']) + sheet.write(row, col + 2, rec['quantity']) + sheet.write(row, col + 3, rec['unit']) + sheet.write(row, col + 4, rec['responsible']) + sheet.write(row, col + 5, rec['start_date']) + sheet.write(row, col + 6, rec['state']) workbook.close() output.seek(0) response.stream.write(output.read()) diff --git a/manufacturing_reports/wizards/mrp_wizard_view.xml b/manufacturing_reports/wizard/mrp_report_views.xml similarity index 76% rename from manufacturing_reports/wizards/mrp_wizard_view.xml rename to manufacturing_reports/wizard/mrp_report_views.xml index 42f48cb83..f0f355a08 100644 --- a/manufacturing_reports/wizards/mrp_wizard_view.xml +++ b/manufacturing_reports/wizard/mrp_report_views.xml @@ -1,16 +1,8 @@ - - - MRP Report - ir.actions.act_window - mrp.report - form - new - - - - MRP Report + + + mrp.report.view.form mrp.report
@@ -29,14 +21,23 @@
-
-
- + + + MRP Report + ir.actions.act_window + mrp.report + form + new +
\ No newline at end of file