From e3b43545519bb17843709b682ae504e18aeae71e Mon Sep 17 00:00:00 2001 From: times-odoo Date: Fri, 8 May 2026 15:23:06 +0530 Subject: [PATCH] [IMP] mrp_bom_overview: clean forecast view with consolidated status column The BOM overview forecast view is simplified by removing visual redundancy and consolidating availability information into the Status column. Changes introduced via patch on BomOverviewLine and inheritance of report.mrp.report_bom_structure: - Remove the standalone BOM name header section as it duplicates the breadcrumb information already visible in the page header - Remove the Availability column to reduce redundancy and consolidate all stock information into the Status column - Display quantity as integer to avoid unnecessary decimal places on whole-number quantities - Ensure 'Ready To Produce' tag is only shown when producible quantity is greater than zero - Always render 'Ready To Produce' tag in green for visual consistency regardless of other conditions - Each component now independently displays its availability state as a colored tag: green for available, dark for estimated, orange for expected, and red for not available - When components are missing, top-level BOM line shows estimated production date instead of 'No Ready To Produce' - All status tags are clickable and navigate to the respective product forecast report task-6204743 --- mrp_bom_overview_forecast/__init__.py | 1 + mrp_bom_overview_forecast/__manifest__.py | 14 +++++++ mrp_bom_overview_forecast/models/__init__.py | 1 + .../models/mrp_report_bom_structure.py | 15 +++++++ .../static/src/bom_overview.xml | 41 +++++++++++++++++++ .../static/src/bom_overview_line.js | 35 ++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 mrp_bom_overview_forecast/__init__.py create mode 100644 mrp_bom_overview_forecast/__manifest__.py create mode 100644 mrp_bom_overview_forecast/models/__init__.py create mode 100644 mrp_bom_overview_forecast/models/mrp_report_bom_structure.py create mode 100644 mrp_bom_overview_forecast/static/src/bom_overview.xml create mode 100644 mrp_bom_overview_forecast/static/src/bom_overview_line.js diff --git a/mrp_bom_overview_forecast/__init__.py b/mrp_bom_overview_forecast/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/mrp_bom_overview_forecast/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_bom_overview_forecast/__manifest__.py b/mrp_bom_overview_forecast/__manifest__.py new file mode 100644 index 00000000000..dcf98e45391 --- /dev/null +++ b/mrp_bom_overview_forecast/__manifest__.py @@ -0,0 +1,14 @@ +{ + "name": "bom_overview", + "version": "1.0", + "depends": ["mrp", "purchase"], + "author": "times", + "category": "Tutorials", + "license": "LGPL-3", + 'installable': True, + "assets": { + "web.assets_backend": [ + "mrp_bom_overview_forecast/static/src/**/*", + ], + }, +} diff --git a/mrp_bom_overview_forecast/models/__init__.py b/mrp_bom_overview_forecast/models/__init__.py new file mode 100644 index 00000000000..d5f0e0470e2 --- /dev/null +++ b/mrp_bom_overview_forecast/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_report_bom_structure diff --git a/mrp_bom_overview_forecast/models/mrp_report_bom_structure.py b/mrp_bom_overview_forecast/models/mrp_report_bom_structure.py new file mode 100644 index 00000000000..ea851bb3ba6 --- /dev/null +++ b/mrp_bom_overview_forecast/models/mrp_report_bom_structure.py @@ -0,0 +1,15 @@ +from odoo import _, models + + +class ReportMrpReport_Bom_Structure(models.AbstractModel): + _inherit = 'report.mrp.report_bom_structure' + + def _get_bom_data(self, *args, **kwargs): + result = super()._get_bom_data(*args, **kwargs) + if result.get('level') == 0: + qty = int(result.get('producible_qty') or 0) + if qty > 0: + result["status"] = _("%(qty)s Ready To Produce", qty=qty) + else: + result["status"] = _("No Ready To Produce") + return result diff --git a/mrp_bom_overview_forecast/static/src/bom_overview.xml b/mrp_bom_overview_forecast/static/src/bom_overview.xml new file mode 100644 index 00000000000..2f019241b62 --- /dev/null +++ b/mrp_bom_overview_forecast/static/src/bom_overview.xml @@ -0,0 +1,41 @@ + + + + + + + o_mrp_bom_report_page py-3 py-lg-2 px-0 overflow-auto border-bottom bg-view + + + + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + props.currentWarehouseId + + + +
diff --git a/mrp_bom_overview_forecast/static/src/bom_overview_line.js b/mrp_bom_overview_forecast/static/src/bom_overview_line.js new file mode 100644 index 00000000000..3e54f58d2e9 --- /dev/null +++ b/mrp_bom_overview_forecast/static/src/bom_overview_line.js @@ -0,0 +1,35 @@ +import { patch } from "@web/core/utils/patch"; +import { BomOverviewLine } from "@mrp/components/bom_overview_line/mrp_bom_overview_line"; + +patch(BomOverviewLine.prototype, { + + get statusData() { + if (this.data.hasOwnProperty('components_available') && this.data.status && this.data.status !== "No Ready To Produce") { + return this.data.status; + } + if (this.data.status === "No Ready To Produce" && this.data.availability_display) { + return this.data.availability_display; + } + if (this.data.availability_display) { + return this.data.availability_display; + } + + return "Not Available"; + }, + + get statusBackgroundClass() { + if (!this.statusData) { + return "text-bg-danger"; + } + if (this.statusData === "Available" || this.statusData.includes("Ready To Produce")) { + return "text-bg-success"; + } + if (this.statusData.includes("Expected")) { + return "text-bg-warning"; + } + if (this.statusData.includes("Estimated")) { + return "text-bg-dark"; + } + return "text-bg-danger"; + }, +});