Skip to content

Commit

Permalink
Add strftime to format date properly bug fix (#150)
Browse files Browse the repository at this point in the history
* Add strftime to format date properly bug fix

* test resolved
  • Loading branch information
Ashutosh619-sudo authored Jul 16, 2024
1 parent 5bf8b2b commit bce9608
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/business_central/exports/journal_entry/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __construct_journal_entry(self, body: JournalEntry, lineitems: List[JournalE
journal_entry_payload = {
'accountType': body.account_type,
'accountNumber': body.account_id,
'postingDate': body.invoice_date,
'postingDate': body.invoice_date.strftime("%Y-%m-%d"),
'documentNumber': body.document_number,
'amount': body.amount,
'comment': body.comment,
Expand All @@ -60,7 +60,7 @@ def __construct_journal_entry(self, body: JournalEntry, lineitems: List[JournalE
journal_entry_lineitem_payload = {
'accountType': lineitem.account_type,
'accountNumber': lineitem.account_id,
'postingDate': lineitem.invoice_date,
'postingDate': lineitem.invoice_date.strftime("%Y-%m-%d"),
'documentNumber': lineitem.document_number,
'amount': lineitem.amount,
'comment': lineitem.comment,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_business_central/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_construct_journal_entry(

assert payload['accountType'] == journal_entry.account_type
assert payload['accountNumber'] == journal_entry.account_id
assert payload['postingDate'] == journal_entry.invoice_date
assert payload['postingDate'] == journal_entry.invoice_date.strftime("%Y-%m-%d")
assert payload['documentNumber'] == journal_entry.document_number


Expand Down

0 comments on commit bce9608

Please sign in to comment.