From 2d4280881de0ca2dd9b7b86801d55f099adf708b Mon Sep 17 00:00:00 2001 From: Benjamin Ulrich <b.ulrich@adito.de> Date: Wed, 29 Sep 2021 14:20:48 +0000 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-Sales][TicketNr.:=201081927][Fe?= =?UTF-8?q?ld=20"Volumen=20(=E2=82=AC)"=20im=20Bereich=20Details=20im=20VP?= =?UTF-8?q?=20sollte=20nicht=20editierbar=20sein=20sowie=20automatisch=20b?= =?UTF-8?q?ef=C3=BCllt=20werden=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Forecast_entity/Forecast_entity.aod | 1 + entity/Forecast_entity/afterSave.js | 21 +++++++++++++++++++ .../Salesproject_entity.aod | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 entity/Forecast_entity/afterSave.js diff --git a/entity/Forecast_entity/Forecast_entity.aod b/entity/Forecast_entity/Forecast_entity.aod index d6a3a8231f..a596f7e006 100644 --- a/entity/Forecast_entity/Forecast_entity.aod +++ b/entity/Forecast_entity/Forecast_entity.aod @@ -4,6 +4,7 @@ <title>${FORECAST_ENGLISH}</title> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Forecast_entity/documentation.adoc</documentation> + <afterSave>%aditoprj%/entity/Forecast_entity/afterSave.js</afterSave> <titlePlural>Forecasts</titlePlural> <recordContainer>db</recordContainer> <entityFields> diff --git a/entity/Forecast_entity/afterSave.js b/entity/Forecast_entity/afterSave.js new file mode 100644 index 0000000000..5465a06689 --- /dev/null +++ b/entity/Forecast_entity/afterSave.js @@ -0,0 +1,21 @@ +import("system.entities"); +import("Sql_lib"); +import("system.vars"); + +var objectType = vars.get("$field.OBJECT_TYPE"); +if(objectType == "Salesproject") +{ + var objectRowId = vars.get("$field.OBJECT_ROWID"); + var volume = newSelect("sum(VOLUME)") + .from("FORECAST") + .where("FORECAST.OBJECT_TYPE", "Salesproject") + .and("FORECAST.OBJECT_ROWID", objectRowId) + .cell(); + + var config = entities.createConfigForUpdatingRows() + .uid(objectRowId) + .addParameter("IgnoreChecklists_param", true) + .fieldValues({"VOLUME": volume}) + .entity("Salesproject_entity"); + entities.updateRow(config); +} \ No newline at end of file diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index b191f7fa4f..f4603f8af4 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -116,6 +116,7 @@ <outputFormat>#,##0.00</outputFormat> <inputFormat>#,##0.00</inputFormat> <groupable v="true" /> + <state>READONLY</state> </entityField> <entityConsumer> <name>Organisations</name> @@ -868,6 +869,7 @@ <outputFormat>#,##0.00</outputFormat> <inputFormat>#,##0.00</inputFormat> <groupable v="true" /> + <state>READONLY</state> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/volumeweighted/valueProcess.js</valueProcess> </entityField> <entityAggregateField> -- GitLab