@@ -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
-
-
-
+
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
-
-
+
+
+ MRP Report
+ ir.actions.act_window
+ mrp.report
+ form
+ new
+
\ No newline at end of file