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"; + }, +});