diff --git a/src/Apps/DE/IntrastatDE/app/AppResources/DE_DataExchDefMap.xml b/src/Apps/DE/IntrastatDE/app/AppResources/DE_DataExchDefMap.xml
index b123be2112..2982becfa1 100644
--- a/src/Apps/DE/IntrastatDE/app/AppResources/DE_DataExchDefMap.xml
+++ b/src/Apps/DE/IntrastatDE/app/AppResources/DE_DataExchDefMap.xml
@@ -344,6 +344,7 @@
+
@@ -574,6 +575,7 @@
+
diff --git a/src/Apps/DE/IntrastatDE/app/src/IntrastatReportDEUpgrade.Codeunit.al b/src/Apps/DE/IntrastatDE/app/src/IntrastatReportDEUpgrade.Codeunit.al
index 015fed199d..1c4466ff0d 100644
--- a/src/Apps/DE/IntrastatDE/app/src/IntrastatReportDEUpgrade.Codeunit.al
+++ b/src/Apps/DE/IntrastatDE/app/src/IntrastatReportDEUpgrade.Codeunit.al
@@ -15,6 +15,7 @@ codeunit 11034 IntrastatReportDEUpgrade
begin
UpdateLinesType();
UpdateDefaultDataExchangeDef();
+ UpdateDataExchangeDefCountryOfOriginGrouping();
end;
local procedure UpdateLinesType()
@@ -53,6 +54,21 @@ codeunit 11034 IntrastatReportDEUpgrade
UpgradeTag.SetUpgradeTag(GetIntrastatDERcptPartnerIDRemovalTag());
end;
+ local procedure UpdateDataExchangeDefCountryOfOriginGrouping()
+ var
+ DataExchDef: Record "Data Exch. Def";
+ IntrastatReportManagementDE: Codeunit IntrastatReportManagementDE;
+ UpgradeTag: Codeunit "Upgrade Tag";
+ begin
+ if UpgradeTag.HasUpgradeTag(GetIntrastatDECountryOfOriginGroupingTag()) then
+ exit;
+
+ if DataExchDef.Get('INTRA-2022-DE') then
+ IntrastatReportManagementDE.CreateDefaultDataExchangeDef();
+
+ UpgradeTag.SetUpgradeTag(GetIntrastatDECountryOfOriginGroupingTag());
+ end;
+
internal procedure GetIntrastatTypeUpdateTag(): Code[250]
begin
exit('MS-481518-IntrastatTypeUpdateDE-20230818');
@@ -63,9 +79,15 @@ codeunit 11034 IntrastatReportDEUpgrade
exit('MS-622161-IntrastatDERcptPartnerIDRemoval-20260301');
end;
+ internal procedure GetIntrastatDECountryOfOriginGroupingTag(): Code[250]
+ begin
+ exit('MS-624364-IntrastatDECountryOfOriginGrouping-20260703');
+ end;
+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Upgrade Tag", 'OnGetPerCompanyUpgradeTags', '', false, false)]
local procedure RegisterUpgradeTags(var PerCompanyUpgradeTags: List of [Code[250]])
begin
PerCompanyUpgradeTags.Add(GetIntrastatDERcptPartnerIDRemovalTag());
+ PerCompanyUpgradeTags.Add(GetIntrastatDECountryOfOriginGroupingTag());
end;
}
diff --git a/src/Apps/DE/IntrastatDE/app/src/IntrastatReportManagementDE.Codeunit.al b/src/Apps/DE/IntrastatDE/app/src/IntrastatReportManagementDE.Codeunit.al
index a8ed7f5351..def91c96dc 100644
--- a/src/Apps/DE/IntrastatDE/app/src/IntrastatReportManagementDE.Codeunit.al
+++ b/src/Apps/DE/IntrastatDE/app/src/IntrastatReportManagementDE.Codeunit.al
@@ -508,10 +508,10 @@ codeunit 11029 IntrastatReportManagementDE
Locked = true; // will be replaced with file import when available
DataExchangeXMLP4Txt: Label 'ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer',
Locked = true; // will be replaced with file import when available
- DataExchangeXMLP5Txt: Label '1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=TRANSACTIONACODETransaction A Code41100000.00TRANSACTIONBCODETransaction B Code42100000.00',
+ DataExchangeXMLP5Txt: Label '1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=TRANSACTIONACODETransaction A Code41100000.00TRANSACTIONBCODETransaction B Code42100000.00',
Locked = true; // will be replaced with file import when available
DataExchangeXMLP6Txt: Label 'ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer1400ALPHANUM_ONLY00001.00=ALPHANUM_ONLYAlphanumeric Text Only70000000.00ROUNDTOINTRound to integer14',
Locked = true; // will be replaced with file import when available
- DataExchangeXMLP7Txt: Label '00ALPHANUM_ONLY00001.00=TRANSACTIONACODETransaction A Code41100000.00TRANSACTIONBCODETransaction B Code42100000.00',
+ DataExchangeXMLP7Txt: Label '00ALPHANUM_ONLY00001.00=TRANSACTIONACODETransaction A Code41100000.00TRANSACTIONBCODETransaction B Code42100000.00',
Locked = true; // will be replaced with file import when available
}
diff --git a/src/Apps/DE/IntrastatDE/test/src/IntrastatReportTestDE.Codeunit.al b/src/Apps/DE/IntrastatDE/test/src/IntrastatReportTestDE.Codeunit.al
index 622a0f7adf..a70eeab14d 100644
--- a/src/Apps/DE/IntrastatDE/test/src/IntrastatReportTestDE.Codeunit.al
+++ b/src/Apps/DE/IntrastatDE/test/src/IntrastatReportTestDE.Codeunit.al
@@ -138,6 +138,26 @@ codeunit 148700 "Intrastat Report Test DE"
'New Intrastat report must inherit the Default Submission Channel from the setup.');
end;
+ [Test]
+ procedure DataExchDefinitionGroupsDetailLinesByCountryOfOrigin()
+ var
+ DataExchFieldGrouping: Record "Data Exch. Field Grouping";
+ begin
+ // [SCENARIO 624364] The INTRA-2022-DE detail line definitions group by Country/Region of Origin (Field ID 24)
+ // so detail lines with the same tariff but different origin country are not merged into one.
+ Initialize();
+
+ // [THEN] The receipt detail line definition groups by Country/Region of Origin (Field ID 24)
+ DataExchFieldGrouping.SetRange("Data Exch. Def Code", IntrastatDEDataExchDefCodeTok);
+ DataExchFieldGrouping.SetRange("Data Exch. Line Def Code", '7-RCPTDETAIL');
+ DataExchFieldGrouping.SetRange("Field ID", 24);
+ Assert.IsFalse(DataExchFieldGrouping.IsEmpty(), 'Receipt detail must group by Country/Region of Origin (Field ID 24).');
+
+ // [THEN] The shipment detail line definition groups by Country/Region of Origin (Field ID 24)
+ DataExchFieldGrouping.SetRange("Data Exch. Line Def Code", '8-SHPTDETAIL');
+ Assert.IsFalse(DataExchFieldGrouping.IsEmpty(), 'Shipment detail must group by Country/Region of Origin (Field ID 24).');
+ end;
+
local procedure Initialize()
var
IntrastatReportSetup: Record "Intrastat Report Setup";