diff --git a/mgmtsystem_indicators_report/__manifest__.py b/mgmtsystem_indicators_report/__manifest__.py index 62236c4c7..cab0b1b18 100644 --- a/mgmtsystem_indicators_report/__manifest__.py +++ b/mgmtsystem_indicators_report/__manifest__.py @@ -32,7 +32,8 @@ "demo": [], "assets": { "web.assets_backend": [ - "mgmtsystem_nonconformity/static/src/js/*,js", + "mgmtsystem_indicators_report/static/src/components/**/*.esm.js", + "mgmtsystem_indicators_report/static/src/components/**/*.xml", ], }, } diff --git a/mgmtsystem_indicators_report/static/src/components/dynamic_selection_indicators_report/dynamic_selection_indicators_report.esm.js b/mgmtsystem_indicators_report/static/src/components/dynamic_selection_indicators_report/dynamic_selection_indicators_report.esm.js new file mode 100644 index 000000000..1504d7b2a --- /dev/null +++ b/mgmtsystem_indicators_report/static/src/components/dynamic_selection_indicators_report/dynamic_selection_indicators_report.esm.js @@ -0,0 +1,30 @@ +/** @odoo-module **/ + +import {SelectionField} from "@web/views/fields/selection/selection_field"; +import {registry} from "@web/core/registry"; + +export class DynamicSelectionIndicatorsReportField extends SelectionField { + get options() { + return this.props.record.data.selection_options.split(",").map((value) => { + return [value, value]; + }); + } + + get string() { + console.log(this.props.value, this.options); + return this.props.value; + } + + onChange(ev) { + const value = JSON.parse(ev.target.value); + + this.props.update(value); + } +} + +DynamicSelectionIndicatorsReportField.supportedTypes = ["char"]; +DynamicSelectionIndicatorsReportField.legacySpecialData = undefined; + +registry + .category("fields") + .add("dynamic_selection_indicators_report", DynamicSelectionIndicatorsReportField); diff --git a/mgmtsystem_indicators_report/static/src/js/field_dynamic_options_dropdown.js b/mgmtsystem_indicators_report/static/src/components/field_dynamic_options_dropdown.js similarity index 100% rename from mgmtsystem_indicators_report/static/src/js/field_dynamic_options_dropdown.js rename to mgmtsystem_indicators_report/static/src/components/field_dynamic_options_dropdown.js diff --git a/mgmtsystem_indicators_report/static/src/js/indicator_value_widget.js b/mgmtsystem_indicators_report/static/src/components/indicator_value_widget.js similarity index 100% rename from mgmtsystem_indicators_report/static/src/js/indicator_value_widget.js rename to mgmtsystem_indicators_report/static/src/components/indicator_value_widget.js diff --git a/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.esm.js b/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.esm.js new file mode 100644 index 000000000..752242812 --- /dev/null +++ b/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.esm.js @@ -0,0 +1,35 @@ +/** @odoo-module **/ + +const {Component} = owl; + +import {Field} from "@web/views/fields/field"; +import {registry} from "@web/core/registry"; + +export class IndicatorsReportValueField extends Component { + get field_props() { + var result = { + name: "value_" + this.props.record.data.value_type, + type: this.props.record.fields["value_" + this.props.record.data.value_type] + .type, + record: this.props.record, + }; + if (this.props.record.data.value_type === "selection") { + result.fieldInfo = { + widget: "dynamic_selection_indicators_report", + FieldComponent: registry + .category("fields") + .get("dynamic_selection_indicators_report"), + }; + } + return result; + } +} + +IndicatorsReportValueField.components = {Field}; +IndicatorsReportValueField.template = + "mgmtsystem_indicators_report.IndicatorsReportValueField"; + +console.log("HI!!!"); +registry + .category("fields") + .add("mgmtsystem_indicators_report_value", IndicatorsReportValueField); diff --git a/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.xml b/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.xml new file mode 100644 index 000000000..7fead4e07 --- /dev/null +++ b/mgmtsystem_indicators_report/static/src/components/indicators_report_value/indicators_report_value.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/mgmtsystem_indicators_report/views/mgmtsystem_indicator_concept.xml b/mgmtsystem_indicators_report/views/mgmtsystem_indicator_concept.xml index 81e72d79c..fd65fff30 100644 --- a/mgmtsystem_indicators_report/views/mgmtsystem_indicator_concept.xml +++ b/mgmtsystem_indicators_report/views/mgmtsystem_indicator_concept.xml @@ -39,7 +39,6 @@ /> -
diff --git a/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report.xml b/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report.xml index 16755f0cc..f26625054 100644 --- a/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report.xml +++ b/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report.xml @@ -120,23 +120,11 @@ widget="section_and_note_text" attrs="{'readonly': ['|', ('concept_id', '!=', False), ('item_blocked', '=', True)]}" /> - - - - - - - + widget="mgmtsystem_indicators_report_value" + /> + @@ -167,7 +155,6 @@ -
diff --git a/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report_template.xml b/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report_template.xml index f0399e9b8..83d472a67 100644 --- a/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report_template.xml +++ b/mgmtsystem_indicators_report/views/mgmtsystem_indicators_report_template.xml @@ -84,7 +84,6 @@ -
diff --git a/setup/mgmtsystem_indicators_report/odoo/addons/mgmtsystem_indicators_report b/setup/mgmtsystem_indicators_report/odoo/addons/mgmtsystem_indicators_report new file mode 120000 index 000000000..8a8593dab --- /dev/null +++ b/setup/mgmtsystem_indicators_report/odoo/addons/mgmtsystem_indicators_report @@ -0,0 +1 @@ +../../../../mgmtsystem_indicators_report \ No newline at end of file diff --git a/setup/mgmtsystem_indicators_report/setup.py b/setup/mgmtsystem_indicators_report/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mgmtsystem_indicators_report/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)