@@ -379,6 +402,7 @@
Industries
+
@@ -394,6 +418,7 @@
sell your products
+
@@ -407,6 +432,7 @@
and convivial experience
+
@@ -419,6 +445,7 @@
educational management
+
@@ -431,6 +458,7 @@
schedule your operations
+
@@ -444,6 +472,7 @@
awe-inspiring product pages
+
@@ -456,6 +485,7 @@
services and invoice
+
@@ -468,6 +498,7 @@
restaurant methodically
+
-
+
+
diff --git a/manufacturing_reports/static/src/js/action_manager.js b/manufacturing_reports/static/src/js/action_manager.js
index 2503b9eed..5663b890f 100644
--- a/manufacturing_reports/static/src/js/action_manager.js
+++ b/manufacturing_reports/static/src/js/action_manager.js
@@ -1,23 +1,31 @@
-/** @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';
+odoo.define('manufacturing_reports .action_manager', function (require) {
+"use strict";
/**
- * @override
- * Add 'xlsx' report type to the report handler
+ * The purpose of this file is to add the actions of type
+ * 'ir_actions_xlsx_download' to the ActionManager.
*/
-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
+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
diff --git a/manufacturing_reports/views/action_manager.xml b/manufacturing_reports/views/action_manager.xml
new file mode 100644
index 000000000..3b3a05647
--- /dev/null
+++ b/manufacturing_reports/views/action_manager.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/manufacturing_reports/views/manufacturing_report_menus.xml b/manufacturing_reports/views/manufacturing_report_menus.xml
deleted file mode 100644
index 4d4f3945c..000000000
--- a/manufacturing_reports/views/manufacturing_report_menus.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/manufacturing_reports/views/menu_items.xml b/manufacturing_reports/views/menu_items.xml
new file mode 100644
index 000000000..b08ba7a3e
--- /dev/null
+++ b/manufacturing_reports/views/menu_items.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/manufacturing_reports/wizard/__init__.py b/manufacturing_reports/wizards/__init__.py
similarity index 86%
rename from manufacturing_reports/wizard/__init__.py
rename to manufacturing_reports/wizards/__init__.py
index bf0d2cfd6..636f7d40d 100644
--- a/manufacturing_reports/wizard/__init__.py
+++ b/manufacturing_reports/wizards/__init__.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
-###############################################################################
+#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
-# Copyright (C) 2023-TODAY Cybrosys Technologies()
-# Author: Javid A (odoo@cybrosys.com)
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Javid A()
#
# 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
+#############################################################################
+from . import mrp_report_wizard
diff --git a/manufacturing_reports/wizard/mrp_report.py b/manufacturing_reports/wizards/mrp_report_wizard.py
similarity index 75%
rename from manufacturing_reports/wizard/mrp_report.py
rename to manufacturing_reports/wizards/mrp_report_wizard.py
index 3bb83bd90..131e9486b 100644
--- a/manufacturing_reports/wizard/mrp_report.py
+++ b/manufacturing_reports/wizards/mrp_report_wizard.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
-###############################################################################
+#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
-# Copyright (C) 2023-TODAY Cybrosys Technologies()
-# Author: Javid A (odoo@cybrosys.com)
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Javid A()
#
# 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,30 +26,18 @@ from odoo.tools import date_utils
from odoo.tools.safe_eval import json
-class MrpReport(models.TransientModel):
- """Class for the transient model mrp report."""
+class MrpReportWizard(models.Model):
_name = 'mrp.report'
_description = 'MRP Report'
- 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.')
+ 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')
stage = fields.Selection(
- [('confirmed', 'Confirmed'), ('planned', 'Planned'),
- ('progress', 'In Progress'),
- ('done', 'Done'), ('cancel', 'Cancelled')], string="Filter State",
- help='Stage of the manufacturing order.')
+ [('confirmed', 'Confirmed'), ('planned', 'Planned'), ('progress', 'In Progress'),
+ ('done', 'Done'), ('cancel', 'Cancelled')], string="Filter State")
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:
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(
@@ -71,8 +58,7 @@ class MrpReport(models.TransientModel):
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),
@@ -80,13 +66,11 @@ class MrpReport(models.TransientModel):
('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),
@@ -101,8 +85,7 @@ class MrpReport(models.TransientModel):
('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),
@@ -131,7 +114,6 @@ class MrpReport(models.TransientModel):
'start_date': rec.date_planned_start,
'state': rec.state,
})
- print('orders', orders)
data = {
'date_from': self.date_from,
'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:
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),
@@ -176,13 +155,11 @@ class MrpReport(models.TransientModel):
('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),
@@ -193,12 +170,10 @@ class MrpReport(models.TransientModel):
('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),
@@ -234,17 +209,14 @@ class MrpReport(models.TransientModel):
'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)
@@ -264,21 +236,21 @@ class MrpReport(models.TransientModel):
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/wizard/mrp_report_views.xml b/manufacturing_reports/wizards/mrp_wizard_view.xml
similarity index 76%
rename from manufacturing_reports/wizard/mrp_report_views.xml
rename to manufacturing_reports/wizards/mrp_wizard_view.xml
index f0f355a08..42f48cb83 100644
--- a/manufacturing_reports/wizard/mrp_report_views.xml
+++ b/manufacturing_reports/wizards/mrp_wizard_view.xml
@@ -1,8 +1,16 @@
-
-
- mrp.report.view.form
+
+
+ MRP Report
+ ir.actions.act_window
+ mrp.report
+ form
+ new
+
+
+
+ MRP Report
mrp.report
+
-
-
- MRP Report
- ir.actions.act_window
- mrp.report
- form
- new
-
+
\ No newline at end of file