From 0cb5981e417ca3a62007adba93878bd7ba7e6ff3 Mon Sep 17 00:00:00 2001
From: Jo Sama <jo.sama@usit.uio.no>
Date: Mon, 16 Aug 2021 11:16:57 +0200
Subject: [PATCH] Post new batches without sending None-fields

Exclude unset values from beeing transfered when posting a new batch to
Setra. Setra does not accept fields set to None (at least period and
vouchertype).
---
 setra_client/client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setra_client/client.py b/setra_client/client.py
index ad39b64..53595a2 100644
--- a/setra_client/client.py
+++ b/setra_client/client.py
@@ -285,7 +285,7 @@ class SetraClient(object):
         url = self.urls.post_new_batch()
         headers = {'Content-Type': 'application/json'}
         response = self.post(url,
-                             data=batchdata.json(),
+                             data=batchdata.json(exclude_unset=True),
                              headers=headers,
                              return_response=True)
         try:
-- 
GitLab