Repository: dennisbakhuis/eboekhouden-python

Issue:
How can the additional fields be exported as well?
Hi,

I want to add a new lid including all it's additional fields. The export function of the relatie object would allow this when specifying the parameter value True. However the add_relatie method of the client object does not have this parameter.

What would be the best way to have this done in a way that fits this library API?

(A library by the way for which I am very grateful.)

Discussion:
@dennisbakhuis: I will add your PR in the new version.

Solution patch:
diff --git a/eboekhouden_python/eboekhouden_client.py b/eboekhouden_python/eboekhouden_client.py
index c483e6e..87b72fb 100644
--- a/eboekhouden_python/eboekhouden_client.py
+++ b/eboekhouden_python/eboekhouden_client.py
@@ -160,14 +160,14 @@ def get_relaties(
         relatie_objects = [Relatie.from_zeep(x) for x in relaties["Relaties"]["cRelatie"]]
         return relatie_objects
 
-    def add_relatie(self, relatie: Relatie) -> str:
+    def add_relatie(self, relatie: Relatie, additional_fields: bool = False) -> str:
         """Add mutatie."""
         self.get_session_id()
 
         response = self._client.service.AddRelatie(
             SessionID=self._session_id,
             SecurityCode2=self._code2,
-            oRel=relatie.export(),
+            oRel=relatie.export(additional_fields),
         )
 
         self._check_response(response)
diff --git a/eboekhouden_python/models/relatie.py b/eboekhouden_python/models/relatie.py
index f5e9108..ace413f 100644
--- a/eboekhouden_python/models/relatie.py
+++ b/eboekhouden_python/models/relatie.py
@@ -98,7 +98,7 @@ def from_zeep(
             def8=serialized_relation.get("Def8"),
             def9=serialized_relation.get("Def9"),
             def10=serialized_relation.get("Def10"),
-            leden_administratie=serialized_relation.get("LedenAdministratie"),
+            leden_administratie=serialized_relation.get("LA"),
             geen_email=serialized_relation.get("GeenEmail"),
             gb_id=serialized_relation.get("GBID"),
             nieuwsbrief_groepen_count=serialized_relation.get("NieuwsbriefGroepenCount"),
@@ -150,7 +150,7 @@ def export(self, additional_fields: bool = False):
                 Def8=self.def8 or ZeepXsdSkipValue,
                 Def9=self.def9 or ZeepXsdSkipValue,
                 Def10=self.def10 or ZeepXsdSkipValue,
-                LedenAdministratie=self.leden_administratie or ZeepXsdSkipValue,
+                LA=self.leden_administratie or ZeepXsdSkipValue,
             )
         return export_dict
 


Test patch:
diff --git a/tests/test_models_relatie.py b/tests/test_models_relatie.py
index 19dd326..7e05c5a 100644
--- a/tests/test_models_relatie.py
+++ b/tests/test_models_relatie.py
@@ -110,7 +110,7 @@ def test_relatie_partially_filled_additional_fields():
         Def8="1",
         Def9="1",
         Def10="1",
-        LedenAdministratie="1",
+        LA="1",
     )