feat: add StateAdministration entity and extend Address with state relation
- Create StateAdministration entity with hierarchical parent relation - Add typeSelect selection (Region, Sub Region, Wilaya, Commune) - Implement computed fullName for hierarchical display - Extend Address entity with many-to-one relation to StateAdministration
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="base" package="com.axelor.apps.base.db" />
|
||||
|
||||
<entity name="Address" lang="java">
|
||||
|
||||
<many-to-one name="state" ref="com.axelor.apps.crm.db.StateAdministration" title="State" />
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="crm" package="com.axelor.apps.crm.db"/>
|
||||
|
||||
<entity name="StateAdministration" lang="java">
|
||||
|
||||
<string name="name" title="Name" required="true"/>
|
||||
<string name="typeSelect" title="Type" selection="state.administration.type.select" required="true"/>
|
||||
|
||||
<many-to-one name="parent" ref="com.axelor.apps.crm.db.StateAdministration"/>
|
||||
|
||||
<string name="fullName" namecolumn="true" title="Full name">
|
||||
<![CDATA[
|
||||
|
||||
String fullName = "";
|
||||
|
||||
com.axelor.apps.crm.db.StateAdministration current = this;
|
||||
|
||||
while (current != null && current.getName() != null) {
|
||||
|
||||
if (fullName.isEmpty()) {
|
||||
fullName = current.getName();
|
||||
} else {
|
||||
fullName = current.getName() + " - " + fullName;
|
||||
}
|
||||
|
||||
current = current.getParent();
|
||||
}
|
||||
|
||||
return fullName;
|
||||
|
||||
]]>
|
||||
</string>
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@@ -143,4 +143,11 @@
|
||||
<option value="1">Some user groups</option>
|
||||
</selection>
|
||||
|
||||
<selection name="state.administration.type.select">
|
||||
<option value="0">Region</option>
|
||||
<option value="1">Sub Region</option>
|
||||
<option value="2">Wilaya</option>
|
||||
<option value="3">Commune</option>
|
||||
</selection>
|
||||
|
||||
</object-views>
|
||||
Reference in New Issue
Block a user