@@ -39,8 +38,7 @@
-
+
|
@@ -67,4 +65,4 @@
-
\ No newline at end of file
+
diff --git a/manufacturing_reports/security/ir.model.access.csv b/manufacturing_reports/security/ir.model.access.csv
old mode 100644
new mode 100755
index a21f91726..ae24349f9
--- a/manufacturing_reports/security/ir.model.access.csv
+++ b/manufacturing_reports/security/ir.model.access.csv
@@ -1,2 +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
+access_manufacturing_report,access.manufacturing.report,model_manufacturing_report,mrp.group_mrp_manager,1,1,1,1
diff --git a/manufacturing_reports/static/description/assets/icons/check.png b/manufacturing_reports/static/description/assets/icons/check.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/chevron.png b/manufacturing_reports/static/description/assets/icons/chevron.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/cogs.png b/manufacturing_reports/static/description/assets/icons/cogs.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/consultation.png b/manufacturing_reports/static/description/assets/icons/consultation.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/ecom-black.png b/manufacturing_reports/static/description/assets/icons/ecom-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/education-black.png b/manufacturing_reports/static/description/assets/icons/education-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/hotel-black.png b/manufacturing_reports/static/description/assets/icons/hotel-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/license.png b/manufacturing_reports/static/description/assets/icons/license.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/lifebuoy.png b/manufacturing_reports/static/description/assets/icons/lifebuoy.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/misc/logo.png b/manufacturing_reports/static/description/assets/icons/logo.png
old mode 100644
new mode 100755
similarity index 100%
rename from manufacturing_reports/static/description/assets/misc/logo.png
rename to manufacturing_reports/static/description/assets/icons/logo.png
diff --git a/manufacturing_reports/static/description/assets/icons/manufacturing-black.png b/manufacturing_reports/static/description/assets/icons/manufacturing-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/pos-black.png b/manufacturing_reports/static/description/assets/icons/pos-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/puzzle.png b/manufacturing_reports/static/description/assets/icons/puzzle.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/restaurant-black.png b/manufacturing_reports/static/description/assets/icons/restaurant-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/service-black.png b/manufacturing_reports/static/description/assets/icons/service-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/trading-black.png b/manufacturing_reports/static/description/assets/icons/trading-black.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/training.png b/manufacturing_reports/static/description/assets/icons/training.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/update.png b/manufacturing_reports/static/description/assets/icons/update.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/user.png b/manufacturing_reports/static/description/assets/icons/user.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/icons/wrench.png b/manufacturing_reports/static/description/assets/icons/wrench.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/misc/categories.png b/manufacturing_reports/static/description/assets/misc/categories.png
deleted file mode 100644
index bedf1e0b1..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/categories.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/check-box.png b/manufacturing_reports/static/description/assets/misc/check-box.png
deleted file mode 100644
index 42caf24b9..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/check-box.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/compass.png b/manufacturing_reports/static/description/assets/misc/compass.png
deleted file mode 100644
index d5fed8faa..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/compass.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/corporate.png b/manufacturing_reports/static/description/assets/misc/corporate.png
deleted file mode 100644
index 2eb13edbf..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/corporate.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/customer-support.png b/manufacturing_reports/static/description/assets/misc/customer-support.png
deleted file mode 100644
index 79efc72ed..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/customer-support.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/cybrosys-logo.png b/manufacturing_reports/static/description/assets/misc/cybrosys-logo.png
deleted file mode 100644
index cc3cc0ccf..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/cybrosys-logo.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/features.png b/manufacturing_reports/static/description/assets/misc/features.png
deleted file mode 100644
index b41769f77..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/features.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/pictures.png b/manufacturing_reports/static/description/assets/misc/pictures.png
deleted file mode 100644
index 56d255fe9..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/pictures.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/pie-chart.png b/manufacturing_reports/static/description/assets/misc/pie-chart.png
deleted file mode 100644
index 426e05244..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/pie-chart.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/right-arrow.png b/manufacturing_reports/static/description/assets/misc/right-arrow.png
deleted file mode 100644
index 730984a06..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/right-arrow.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/star.png b/manufacturing_reports/static/description/assets/misc/star.png
deleted file mode 100644
index 2eb9ab29f..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/star.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/support.png b/manufacturing_reports/static/description/assets/misc/support.png
deleted file mode 100644
index 4f18b8b82..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/support.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/misc/whatsapp.png b/manufacturing_reports/static/description/assets/misc/whatsapp.png
deleted file mode 100644
index d513a5356..000000000
Binary files a/manufacturing_reports/static/description/assets/misc/whatsapp.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/1.png b/manufacturing_reports/static/description/assets/modules/1.png
deleted file mode 100644
index 5238bdeab..000000000
Binary files a/manufacturing_reports/static/description/assets/modules/1.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/3.png b/manufacturing_reports/static/description/assets/modules/3.png
deleted file mode 100644
index 3c3ff1afb..000000000
Binary files a/manufacturing_reports/static/description/assets/modules/3.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/4.png b/manufacturing_reports/static/description/assets/modules/4.png
deleted file mode 100644
index 3fae4631e..000000000
Binary files a/manufacturing_reports/static/description/assets/modules/4.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/5.gif b/manufacturing_reports/static/description/assets/modules/5.gif
deleted file mode 100644
index 2a5f8e659..000000000
Binary files a/manufacturing_reports/static/description/assets/modules/5.gif and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/6.png b/manufacturing_reports/static/description/assets/modules/6.png
deleted file mode 100644
index 7f2815273..000000000
Binary files a/manufacturing_reports/static/description/assets/modules/6.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/modules/budget_image.png b/manufacturing_reports/static/description/assets/modules/budget_image.png
new file mode 100755
index 000000000..b50130c7d
Binary files /dev/null and b/manufacturing_reports/static/description/assets/modules/budget_image.png differ
diff --git a/manufacturing_reports/static/description/assets/modules/credit_image.png b/manufacturing_reports/static/description/assets/modules/credit_image.png
new file mode 100755
index 000000000..3ad04ecfd
Binary files /dev/null and b/manufacturing_reports/static/description/assets/modules/credit_image.png differ
diff --git a/manufacturing_reports/static/description/assets/modules/employee_image.png b/manufacturing_reports/static/description/assets/modules/employee_image.png
new file mode 100755
index 000000000..30ad58232
Binary files /dev/null and b/manufacturing_reports/static/description/assets/modules/employee_image.png differ
diff --git a/manufacturing_reports/static/description/assets/modules/export_image.png b/manufacturing_reports/static/description/assets/modules/export_image.png
new file mode 100755
index 000000000..492980ad0
Binary files /dev/null and b/manufacturing_reports/static/description/assets/modules/export_image.png differ
diff --git a/manufacturing_reports/static/description/assets/modules/2.png b/manufacturing_reports/static/description/assets/modules/gantt_image.png
old mode 100644
new mode 100755
similarity index 100%
rename from manufacturing_reports/static/description/assets/modules/2.png
rename to manufacturing_reports/static/description/assets/modules/gantt_image.png
diff --git a/manufacturing_reports/static/description/assets/modules/quotation_image.png b/manufacturing_reports/static/description/assets/modules/quotation_image.png
new file mode 100755
index 000000000..499b1a72f
Binary files /dev/null and b/manufacturing_reports/static/description/assets/modules/quotation_image.png differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/01.png b/manufacturing_reports/static/description/assets/screenshots/01.png
new file mode 100755
index 000000000..6b0b262b0
Binary files /dev/null and b/manufacturing_reports/static/description/assets/screenshots/01.png differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/02.png b/manufacturing_reports/static/description/assets/screenshots/02.png
new file mode 100755
index 000000000..bbb874a96
Binary files /dev/null and b/manufacturing_reports/static/description/assets/screenshots/02.png differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/14_1.png b/manufacturing_reports/static/description/assets/screenshots/14_1.png
deleted file mode 100644
index e3e6d92ab..000000000
Binary files a/manufacturing_reports/static/description/assets/screenshots/14_1.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/14_2.png b/manufacturing_reports/static/description/assets/screenshots/14_2.png
deleted file mode 100644
index 26cfd50cf..000000000
Binary files a/manufacturing_reports/static/description/assets/screenshots/14_2.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/14_3.png b/manufacturing_reports/static/description/assets/screenshots/14_3.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/screenshots/14_4.png b/manufacturing_reports/static/description/assets/screenshots/14_4.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/assets/screenshots/Manufacturing-reports-gif.gif b/manufacturing_reports/static/description/assets/screenshots/Manufacturing-reports-gif.gif
new file mode 100755
index 000000000..d0ba24d7d
Binary files /dev/null and b/manufacturing_reports/static/description/assets/screenshots/Manufacturing-reports-gif.gif differ
diff --git a/manufacturing_reports/static/description/assets/screenshots/hero.png b/manufacturing_reports/static/description/assets/screenshots/hero.png
deleted file mode 100644
index 2a798a5ca..000000000
Binary files a/manufacturing_reports/static/description/assets/screenshots/hero.png and /dev/null differ
diff --git a/manufacturing_reports/static/description/banner.png b/manufacturing_reports/static/description/banner.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/icon.png b/manufacturing_reports/static/description/icon.png
old mode 100644
new mode 100755
diff --git a/manufacturing_reports/static/description/index.html b/manufacturing_reports/static/description/index.html
old mode 100644
new mode 100755
index 94e74026b..bb233e378
--- a/manufacturing_reports/static/description/index.html
+++ b/manufacturing_reports/static/description/index.html
@@ -1,538 +1,581 @@
-
-
-
- 
-
-
- Community
-
-
- Enterprise
-
-
- Odoo.sh
+
+
+
+
+
-
-
-
-
-
-
-
-
- Manufacturing Reports
-
- PDF & XLSX Reports For Manufacturing Module
-
- 
+
+
+ Community
+
+
+ Enterprise
+
+
-
-
-
- 
+
+
+
+
+
+ Manufacturing Reports
+
+ PDF & XLS Reports For Manufacturing Module
+
+ 
+
- Explore This
- Module
-
-
-
-
-
-
- Overview
- Learn
- more about this
- module
+
+
+
+
+ Explore this module
+
+
+
- 
-
-
-
-
-
-
-
- 
-
- Overview
-
-
-
-
- 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
- large and small business MRP systems.
-
-
-
-
-
- 
+
+
+
+ Overview
+
+
+
+
+
+ Manufacturing Reports is a free Cybrosys MRP software which helps to generate advanced
+ report for MRP (Material requirements planning) module.This allows both 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.
+
+
+
- Features
-
-
-
-
-
- 
- Filter manufacturing orders by product.
+
+
+
+
+
+ Features
+
-
- 
-
- Filter manufacturing orders by start date.
-
+
+
+
+ 
+
+
+
+ Filter manufacturing orders based on Product
+
-
- 
-
- Filter manufacturing orders by responsible person.
-
+
+
+
+ 
+
+
+
+ Filter the orders date
+
-
- 
-
- Filter orders based on the status of the production.
+
+
+
+ 
+
+
+
+ Filter orders based on the status of the production
+
-
- 
-
- Compatible with Community, Enterprise and Odoo.sh.
+
+
+
+ 
+
+
+
+ Filter based on the responsible person for production
+
-
-
-
-
-
-
-
- Screenshots
-
-
-
-
-
-
- Go to Manufacturing >> Reporting >> Manufacturing Reports to print the reports.
-
- 
+
+
+
+ Screenshots
+
+
+
+
+ Go to Manufacturing >> Reporting >> Manufacturing Reports to print the reports.
+
-
-
+
+
You can print PDF and XLS report. You can also filter it by products, State,
- Start Date and Responsible Person
-
+ Start Date and Responsible Person
+
-
-
- PDF report with images.
- 
+
+
+
+ PDF report with images.
+
-
-
- XLS report
-
- 
+
+
+
+
+ XLS report
+
-
-
-
-
-
-
- 
+
+
+
- Related
- Products
-
-
-
-
-
-
-
-
-
+
+
+
+ Suggested Products
+
+
+
-
-
-
-
-
- 
-
- Our Services
-
-
-
-
-
-
- 
-
-
- Odoo
- Customization
-
-
-
- 
-
-
- Odoo
- Implementation
-
-
-
- 
-
-
- Odoo
- Support
-
-
-
- 
-
-
- Hire
- Odoo
- Developer
-
-
-
- 
-
-
- Odoo
- Integration
-
-
-
- 
-
-
- Odoo
- Migration
-
-
-
- 
-
-
- Odoo
- Consultancy
-
-
-
- 
-
-
- Odoo
- Implementation
-
-
-
- 
-
-
- Odoo
- Licensing Consultancy
+
+
+
+
+
+
+
-
-
+
-
-
-
- 
-
- Our
- Industries
-
-
-
-
-
-
- 
-
- Trading
-
-
- Easily procure
- and
- sell your products
+
+
+
-
-
- 
-
- POS
-
-
- Easy
- configuration
- and convivial experience
+
+
+
+ 
+
+
+ Odoo
+ Customization
-
-
-
- 
-
- Education
-
-
- A platform for
- educational management
+
+
+
+ 
+
+
+ Odoo
+ Implementation
-
-
-
- 
-
- Manufacturing
-
-
- Plan, track and
- schedule your operations
+
+
+
+ 
+
+
+ Odoo
+ Support
-
-
-
- 
-
- E-commerce & Website
-
-
- Mobile
- friendly,
- awe-inspiring product pages
+
+
+
+
+ 
+
+
+ Hire
+ Odoo
+ Developer
-
-
-
- 
-
- Service Management
-
-
- Keep track of
- services and invoice
+
+
+
+ 
+
+
+ Odoo
+ Integration
-
-
-
- 
-
- Restaurant
-
-
- Run your bar or
- restaurant methodically
+
+
+
+ 
+
+
+ Odoo
+ Migration
-
-
-
- 
-
- Hotel Management
-
-
- An
- all-inclusive
- hotel management application
+
+
+
+
+ 
+
+
+ Odoo
+ Consultancy
-
-
-
-
-
-
-
- 
-
- Support
-
-
-
-
-
-
-
- 
+
+
+
-
+
+
+
+
+
+ Odoo
+ Licensing Consultancy
-
-
-
- 
+
+
+
+
+
+
+
+ Our Industries
+
+
+
+
+
+ 
+
+ Trading
+
+
+ Easily procure
+ and
+ sell your products
-
+
+
+
+ 
+
+ POS
+
+
+ Easy
+ configuration
+ and convivial experience
+
+
+
+
+
+ 
+
+ Education
+
+
+ A platform for
+ educational management
+
+
+
+
+
+ 
+
+ Manufacturing
+
+
+ Plan, track and
+ schedule your operations
+
+
+
+
+
+ 
+
+ E-commerce & Website
+
+
+ Mobile
+ friendly,
+ awe-inspiring product pages
+
+
+
+
+
+ 
+
+ Service Management
+
+
+ Keep track of
+ services and invoice
+
+
+
+
+
+ 
+
+ Restaurant
+
+
+ Run your bar or
+ restaurant methodically
+
+
+
+ 
+
+ Hotel Management
+
+
+ An
+ all-inclusive
+ hotel management application
+
+
+
-
-
-
- 
+
+
+
+
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
diff --git a/manufacturing_reports/static/src/js/action_manager.js b/manufacturing_reports/static/src/js/action_manager.js
old mode 100644
new mode 100755
index 2503b9eed..304122b8b
--- a/manufacturing_reports/static/src/js/action_manager.js
+++ b/manufacturing_reports/static/src/js/action_manager.js
@@ -1,23 +1,21 @@
-/** @odoo-module */
+//@odoo-modules
+
import { registry } from "@web/core/registry";
-import { download } from "@web/core/network/download";
import framework from 'web.framework';
import session from 'web.session';
-/**
- * @override
- * Add 'xlsx' report type to the report handler
- */
+
+//report_type is added into a registry and checks report_type is ‘XLSX.’Then call the corresponding controller function
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
+ 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;
+ }
+})
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/wizard/__init__.py b/manufacturing_reports/wizard/__init__.py
old mode 100644
new mode 100755
index bf0d2cfd6..85d510162
--- a/manufacturing_reports/wizard/__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 (odoo@cybrosys.com)
+# 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 manufacturing_report
diff --git a/manufacturing_reports/wizard/manufacturing_report.py b/manufacturing_reports/wizard/manufacturing_report.py
new file mode 100755
index 000000000..ce50081c3
--- /dev/null
+++ b/manufacturing_reports/wizard/manufacturing_report.py
@@ -0,0 +1,175 @@
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+# Cybrosys Technologies Pvt. Ltd.
+#
+# 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
+#
+# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+# (AGPL v3) along with this program.
+# If not, see .
+#
+#############################################################################
+from odoo import fields, models
+from odoo.tools import date_utils
+from odoo.tools.safe_eval import json
+
+try:
+ from odoo.tools.misc import xlsxwriter
+except ImportError:
+ import xlsxwriter
+import io
+
+
+class ManufacturingReport(models.TransientModel):
+ """
+ This class creates a new model named manufacturing report and has the
+ fields to filter the report
+ """
+ _name = 'manufacturing.report'
+ _description = 'Manufacturing Report'
+
+ filter = fields.Boolean(string='Enable Filter by Date',
+ help='Enabling filter by date allows you to filter '
+ 'the records by date')
+ date_from = fields.Date(string='Start Date',
+ help='Filter by starting date')
+ filter_user = fields.Boolean(string='Filter On Responsible',
+ help='Enabling filter on responsible allows '
+ 'you to filter the records by '
+ 'responsible person')
+ responsible_ids = fields.Many2many('res.users',
+ string='Responsible',
+ help='Filter by Responsible Person')
+ product_ids = fields.Many2many('product.product',
+ string='Product',
+ help='Filter by Products')
+ state = fields.Selection(
+ [('confirmed', 'Confirmed'), ('planned', 'Planned'),
+ ('progress', 'In Progress'),
+ ('done', 'Done'), ('cancel', 'Cancelled')], string="State",
+ help='Filter by states')
+
+ def fetch_data(self):
+ """fetches the data and append to a list and returns it"""
+ conditions = []
+ if self.product_ids:
+ conditions.append(('product_id', 'in', self.product_ids.ids))
+ if self.state:
+ conditions.append(('state', '=', self.state))
+ if self.date_from:
+ conditions.append(('date_planned_start', '>=', self.date_from))
+ if self.responsible_ids:
+ conditions.append(('user_id', 'in', self.responsible_ids.ids))
+ mrp_orders = self.env['mrp.production'].search(conditions)
+ return mrp_orders
+
+ def action_print_xlsx(self):
+ """Calls the fetch_data function and print the Excel report"""
+ mrp_orders = self.fetch_data()
+ orders = [{
+ 'name': rec.name,
+ 'product': rec.product_id.name,
+ 'quantity': rec.product_qty,
+ 'unit': rec.product_uom_category_id.name,
+ 'responsible': rec.user_id.name,
+ 'start_date': rec.date_planned_start,
+ 'state': rec.state,
+ } for rec in mrp_orders]
+ data = {
+ 'date_from': self.date_from,
+ 'state': self.state,
+ 'mrp': orders
+ }
+ return {
+ 'type': 'ir.actions.report',
+ 'data': {
+ 'model': 'manufacturing.report',
+ 'options': json.dumps(data, default=date_utils.json_default),
+ 'output_format': 'xlsx',
+ 'report_name': 'Manufacturing Report', },
+ 'report_type': 'xlsx',
+ }
+
+ def action_print_pdf(self):
+ """Calls the fetch_data function and print the PDF report"""
+ mrp_orders = self.fetch_data()
+ orders = [{
+ 'name': rec.name,
+ 'image': rec.product_id.image_1920,
+ 'product': rec.product_id.name,
+ 'quantity': rec.product_qty,
+ 'unit': rec.product_uom_category_id.name,
+ 'responsible': rec.user_id.name,
+ 'start_date': rec.date_planned_start,
+ 'state': rec.state,
+ } for rec in mrp_orders]
+ data = {
+ 'date_from': self.date_from,
+ 'state': self.state,
+ 'mrp': orders
+ }
+ return self.env.ref(
+ 'manufacturing_reports.action_report_mrp').report_action(self,
+ data=data)
+
+ def get_xlsx_report(self, data, response):
+ """
+ Set the rows and column for datas to print in Excel sheet
+ :param data: The records data
+ :param response: the corresponding response
+ :return: XLSX file
+ """
+ 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'})
+ txt_head = workbook.add_format({'font_size': '12px'})
+ sheet.set_column('B:B', 15)
+ sheet.set_column('C:C', 15)
+ sheet.set_column('D:D', 16)
+ sheet.set_column('E:E', 11)
+ sheet.set_column('F:F', 11)
+ sheet.set_column('G:G', 15)
+ sheet.set_column('H:H', 19)
+ sheet.set_column('I:I', 15)
+ sheet.merge_range('B2:H3', 'Manufacturing Orders', head)
+ if data['date_from']:
+ sheet.write('B6', 'From:', cell_format)
+ sheet.merge_range('C6:D6', data['date_from'], txt_head)
+ if data['state']:
+ sheet.write('B7', 'State:', cell_format)
+ sheet.merge_range('C7:D7', data['state'], txt_head)
+ 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)
+ 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'])
+ workbook.close()
+ output.seek(0)
+ response.stream.write(output.read())
+ output.close()
diff --git a/manufacturing_reports/wizard/mrp_report_views.xml b/manufacturing_reports/wizard/manufacturing_report_views.xml
old mode 100644
new mode 100755
similarity index 51%
rename from manufacturing_reports/wizard/mrp_report_views.xml
rename to manufacturing_reports/wizard/manufacturing_report_views.xml
index f0f355a08..39b8a27b4
--- a/manufacturing_reports/wizard/mrp_report_views.xml
+++ b/manufacturing_reports/wizard/manufacturing_report_views.xml
@@ -1,43 +1,39 @@
-
-
- mrp.report.view.form
- mrp.report
+
+ manufacturing.report.view.form
+ manufacturing.report
-
-
+
MRP Report
ir.actions.act_window
- mrp.report
+ manufacturing.report
form
new
-
\ No newline at end of file
+
+
diff --git a/manufacturing_reports/wizard/mrp_report.py b/manufacturing_reports/wizard/mrp_report.py
deleted file mode 100644
index 3bb83bd90..000000000
--- a/manufacturing_reports/wizard/mrp_report.py
+++ /dev/null
@@ -1,285 +0,0 @@
-# -*- coding: utf-8 -*-
-###############################################################################
-#
-# Cybrosys Technologies Pvt. Ltd.
-#
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
-#
-# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
-# (AGPL v3) along with this program.
-# If not, see .
-#
-###############################################################################
-import io
-import xlsxwriter
-from odoo import fields, models
-from odoo.tools import date_utils
-from odoo.tools.safe_eval import json
-
-
-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',
- 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",
- help='Stage of the manufacturing order.')
-
- def check_report(self):
- """
- Function to fetch the mrp orders according to the filters given in
- the wizard and print the XLS report
- """
- orders = []
- 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),
- ('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)])
- 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)])
- 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),
- ('date_planned_start', '>=', self.date_from),
- ('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),
- ('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)])
- elif self.product_id and self.date_from:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids),
- ('date_planned_start', '>=', self.date_from)])
- elif self.product_id and self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids),
- ('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)])
- elif self.stage and self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('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),
- ('user_id', 'in', self.responsible_id.ids)])
- elif self.product_id:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids)])
- elif self.stage:
- mrp_orders = self.env['mrp.production'].search(
- [('state', '=', self.stage)])
- elif self.date_from:
- mrp_orders = self.env['mrp.production'].search(
- [('date_planned_start', '>=', self.date_from)])
- elif self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('user_id', 'in', self.responsible_id.ids)])
- else:
- mrp_orders = self.env['mrp.production'].search([])
- for rec in mrp_orders:
- orders.append({
- 'name': rec.name,
- 'product': rec.product_id.name,
- 'quantity': rec.product_qty,
- 'unit': rec.product_uom_category_id.name,
- 'responsible': rec.user_id.name,
- 'start_date': rec.date_planned_start,
- 'state': rec.state,
- })
- print('orders', orders)
- data = {
- 'date_from': self.date_from,
- 'stage': self.stage,
- 'mrp': orders
- }
- return {
- 'type': 'ir.actions.report',
- 'data': {
- 'model': 'mrp.report',
- 'options': json.dumps(data, default=date_utils.json_default),
- 'output_format': 'xlsx',
- 'report_name': 'Manufacturing Report', },
- 'report_type': 'xlsx',
- }
-
- def print_pdf(self):
- """
- Function to fetch the mrp orders according to the filters given in
- the wizard and print the PDF report
- """
- orders = []
- 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),
- ('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)])
- 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)])
- 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),
- ('date_planned_start', '>=', self.date_from),
- ('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),
- ('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)])
- elif self.product_id and self.date_from:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids),
- ('date_planned_start', '>=', self.date_from)])
- elif self.product_id and self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids),
- ('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)])
- elif self.stage and self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('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),
- ('user_id', 'in', self.responsible_id.ids)])
- elif self.product_id:
- mrp_orders = self.env['mrp.production'].search(
- [('product_id', 'in', self.product_id.ids)])
- elif self.stage:
- mrp_orders = self.env['mrp.production'].search(
- [('state', '=', self.stage)])
- elif self.date_from:
- mrp_orders = self.env['mrp.production'].search(
- [('date_planned_start', '>=', self.date_from)])
- elif self.responsible_id:
- mrp_orders = self.env['mrp.production'].search(
- [('user_id', 'in', self.responsible_id.ids)])
- else:
- mrp_orders = self.env['mrp.production'].search([])
- for rec in mrp_orders:
- orders.append({
- 'name': rec.name,
- 'image': rec.product_id.image_1920,
- 'product': rec.product_id.name,
- 'quantity': rec.product_qty,
- 'unit': rec.product_uom_category_id.name,
- 'responsible': rec.user_id.name,
- 'start_date': rec.date_planned_start,
- 'state': rec.state,
- })
- data = {
- 'date_from': self.date_from,
- 'stage': self.stage,
- 'mrp': orders
- }
- return self.env.ref(
- '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'})
- txt_head = workbook.add_format({'font_size': '12px'})
- sheet.set_column('B:B', 15)
- sheet.set_column('C:C', 15)
- sheet.set_column('D:D', 16)
- sheet.set_column('E:E', 11)
- sheet.set_column('F:F', 11)
- sheet.set_column('G:G', 15)
- sheet.set_column('H:H', 19)
- sheet.set_column('I:I', 15)
- sheet.merge_range('B2:H3', 'Manufacturing Orders', head)
- if data['date_from']:
- sheet.write('B6', 'From:', cell_format)
- sheet.merge_range('C6:D6', data['date_from'], txt_head)
- if data['stage']:
- sheet.write('B7', 'State:', cell_format)
- sheet.merge_range('C7:D7', data['stage'], txt_head)
- 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)
- 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'])
- workbook.close()
- output.seek(0)
- response.stream.write(output.read())
- output.close()
|