Skip to content

Commit

Permalink
Revert "Revert "Update attachments in serial (#407)" (#408)" (#410)
Browse files Browse the repository at this point in the history
* Revert "Revert "Update attachments in serial (#407)" (#408)"

This reverts commit 5581226.

* add loggers

* temp add sdk

* rm temp code

* rm
  • Loading branch information
ashwin1111 authored Jan 11, 2024
1 parent 10488ae commit b21bab1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion apps/sage_intacct/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,16 +1351,29 @@ def post_attachments(self, attachments: List[Dict], supdoc_id: str):
attachments_list.append(attachment_to_append)
attachment_number = attachment_number + 1

first_attachment = [attachments_list[0]]

data = {
'supdocid': supdoc_id,
'supdocfoldername': 'FyleAttachments',
'attachments': {
'attachment': attachments_list
'attachment': first_attachment
}
}

created_attachment = self.connection.attachments.post(data)

if len(attachments_list) > 1:
for attachment in attachments_list[1:]:
attachment_data = {
'supdocid': supdoc_id,
'supdocfoldername': 'FyleAttachments',
'attachments': {
'attachment': [attachment]
}
}
self.connection.attachments.update(attachment_data)

if created_attachment['status'] == 'success' and created_attachment['key']:
return supdoc_id

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pytest-cov==3.0.0
pytest-django==4.5.2
pytest-mock==3.8.2
requests==2.25.0
sageintacctsdk==1.16.1
sageintacctsdk==1.18.0
sentry-sdk==1.19.1
six==1.13.0
Unidecode==1.1.2

0 comments on commit b21bab1

Please sign in to comment.