From 55e9f4455c3d12a797103cf4809f2a9b55b6dfb7 Mon Sep 17 00:00:00 2001 From: Kheireddine Mehdi Date: Tue, 3 Mar 2026 12:03:54 +0100 Subject: [PATCH 1/2] 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 --- .../src/main/resources/domains/Address.xml | 13 ++++++ .../resources/domains/StateAdministration.xml | 40 +++++++++++++++++++ .../src/main/resources/views/Selects.xml | 7 ++++ 3 files changed, 60 insertions(+) create mode 100644 modules/axelor-open-suite/axelor-crm/src/main/resources/domains/Address.xml create mode 100644 modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml diff --git a/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/Address.xml b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/Address.xml new file mode 100644 index 0000000..3a0ed53 --- /dev/null +++ b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/Address.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml new file mode 100644 index 0000000..3c8f413 --- /dev/null +++ b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/modules/axelor-open-suite/axelor-crm/src/main/resources/views/Selects.xml b/modules/axelor-open-suite/axelor-crm/src/main/resources/views/Selects.xml index 12b1d52..40fda55 100644 --- a/modules/axelor-open-suite/axelor-crm/src/main/resources/views/Selects.xml +++ b/modules/axelor-open-suite/axelor-crm/src/main/resources/views/Selects.xml @@ -143,4 +143,11 @@ + + + + + + + \ No newline at end of file From 936c00cda407d2cd5cf039d04b98cac8a1888da0 Mon Sep 17 00:00:00 2001 From: Kheireddine Mehdi Date: Tue, 10 Mar 2026 09:20:00 +0100 Subject: [PATCH 2/2] fix(crm): prevent infinite loop when StateAdministration parent is itself --- .../src/main/resources/domains/StateAdministration.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml index 3c8f413..dbe5be1 100644 --- a/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml +++ b/modules/axelor-open-suite/axelor-crm/src/main/resources/domains/StateAdministration.xml @@ -21,12 +21,18 @@ while (current != null && current.getName() != null) { + if (current == current.getParent()) { + break; + } + if (fullName.isEmpty()) { fullName = current.getName(); } else { fullName = current.getName() + " - " + fullName; } + + current = current.getParent(); }