diff --git a/.gitignore b/.gitignore index b6e47617de1..36e9db67f87 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,4 @@ dmypy.json # Pyre type checker .pyre/ +/shop \ No newline at end of file diff --git a/mrp_bom_overview_forecast/__init__.py b/mrp_bom_overview_forecast/__init__.py new file mode 100644 index 00000000000..4920c6bc8a0 --- /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..079e255fdce --- /dev/null +++ b/mrp_bom_overview_forecast/__manifest__.py @@ -0,0 +1,14 @@ +{ + "name": "bom_overview", + "version": "1.0", + "depends": ["mrp"], + "author": "vikvi", + "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..8dd98b46535 --- /dev/null +++ b/mrp_bom_overview_forecast/models/__init__.py @@ -0,0 +1 @@ +from .import mrp_bom_report diff --git a/mrp_bom_overview_forecast/models/mrp_bom_report.py b/mrp_bom_overview_forecast/models/mrp_bom_report.py new file mode 100644 index 00000000000..b5e565bc81a --- /dev/null +++ b/mrp_bom_overview_forecast/models/mrp_bom_report.py @@ -0,0 +1,15 @@ +from odoo import models, _ + + +class Mrp_Bom_Report(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_forecast.js b/mrp_bom_overview_forecast/static/src/bom_forecast.js new file mode 100644 index 00000000000..7f8ed9da4f9 --- /dev/null +++ b/mrp_bom_overview_forecast/static/src/bom_forecast.js @@ -0,0 +1,34 @@ +import { patch } from "@web/core/utils/patch"; +import { BomOverviewLine } from "@mrp/components/bom_overview_line/mrp_bom_overview_line"; + + +patch(BomOverviewLine.prototype, { + get status() { + let ready_to_produce = this.data.producible_qty ? this.data.producible_qty > 0 : false; + + if (this.data.hasOwnProperty('components_available') && this.data.status && ready_to_produce) { + return this.data.status; + } + if (!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 statusStyleClass() { + let ready_to_produce = this.data.producible_qty ? this.data.producible_qty > 0 : false; + + if (!this.status || this.status == "Not Available") return "text-bg-danger"; + if (this.status && (ready_to_produce || this.status === "Available")) { + return "bg-success text-white fw-bold"; + } + if (this.status && this.status.includes("Estimated")) return "text-bg-warning"; + if (this.status && !ready_to_produce) { + return "bg-dark text-white fw-bold"; + } + return "text-bg-danger"; + } +}) diff --git a/mrp_bom_overview_forecast/static/src/bom_forecast.xml b/mrp_bom_overview_forecast/static/src/bom_forecast.xml new file mode 100644 index 00000000000..6a34dd9d274 --- /dev/null +++ b/mrp_bom_overview_forecast/static/src/bom_forecast.xml @@ -0,0 +1,23 @@ + + + + + + o_mrp_bom_report_page py-3 py-lg-2 px-0 overflow-auto border-bottom bg-view + + + + + + + + + + +
+ +
+ +
+
+