cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements: Make translations readonly

lvi
Employee
Employee
0 Kudos

We're developing a Fiori Elements admin UI for a new product. One of our entities has an editable field that controls whether or not it can be updated/deleted. We've gotten it to work with the main entity, but contained texts aren't respecting the Capabilities and Restrictions:

 

entity ItemType : CodeList {
  key code       : String(40);
      editable   : Boolean default true;
}

annotate ItemType with @(
  Capabilities.Updatable             : editable,
  Capabilities.Deletable             : editable,
);

 

The snippet above works well for all properties of the entity, but the contained, localised texts (from CodeList) don't respect it. Adding NavigationRestrictions to the texts contained entity results in a UI error:

 

annotate ItemType with @(
  Capabilities.NavigationRestrictions: {RestrictedProperties: [{
    NavigationProperty: texts,
    InsertRestrictions: {Insertable: editable},
    UpdateRestrictions: {Updatable: editable},
    DeleteRestrictions: {Deletable: editable},
  }]}
);

 

 The error:

 

TypeError: Cannot read properties of undefined (reading 'name')
    at https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1928:8049
    at Array.map ()
    at https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1928:8040
    at Array.forEach ()
    at B (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1928:7783)
    at q (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1928:8749)
    at $ (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1928:5947)
    at Object.ae [as getEditMode] (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/core/library-preload.js:1978:4070)
    at i.e [as computeEditMode] (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/macros/library-preload.js:838:17492)
    at new i (https://sapui5.hana.ondemand.com/1.120.1/resources/sap/fe/macros/library-preload.js:838:15794)

 

Looking at the batch requests, after adding the UpdateRestrictions the batch requests no longer selected name and description.

How can I ensure that the translations for any given entity with editable set to false are also readonly?

Accepted Solutions (0)

Answers (0)