diff --git a/.gitignore b/.gitignore index b6e47617de1..0422e30486a 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,8 @@ dmypy.json # Pyre type checker .pyre/ + +/vanilla_js +/health +/library +/hr_loan 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..9bd80afb001 --- /dev/null +++ b/mrp_bom_overview_forecast/__manifest__.py @@ -0,0 +1,15 @@ +{ + "name": "mrp_bom_overview_forecast", + "version": "1.0", + "depends": ["mrp", "purchase"], + "author": "times", + "category": "Tutorials", + "license": "LGPL-3", + 'installable': True, + 'auto_install': 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..82eff50ac14 --- /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..2f3dbcebdea --- /dev/null +++ b/mrp_bom_overview_forecast/static/src/bom_overview_line.js @@ -0,0 +1,43 @@ +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')) { + const qty = parseInt(this.data.producible_qty) || 0; + if (qty > 0) { + return this.data.status; + } + if (qty == 0 && 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.data.hasOwnProperty('components_available')) { + const qty = parseInt(this.data.producible_qty) || 0; + if (qty > 0) { + return "text-bg-success"; + } + } + + const state = this.data.availability_state; + switch (state) { + case "available": + return "text-bg-success"; + case "expected": + return "text-bg-warning"; + case "estimated": + return "text-bg-dark"; + default: + return "text-bg-danger"; + } + }, +});