Skip to content

Commit

Permalink
flake fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Nov 21, 2024
1 parent cf34162 commit 2ea85f7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
6 changes: 2 additions & 4 deletions apps/business_central/exports/journal_entry/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ def post(self, accounting_export, item, lineitem):
)
)
response["dimension_line_responses"] = dimension_line_responses


expenses = accounting_export.expenses.all()

# Load attachments to Business Central
for i in range(1, len(response["responses"])):
load_attachments(
Expand All @@ -115,12 +113,12 @@ def post(self, accounting_export, item, lineitem):
accounting_export)

return response

def construct_dimension_set_line_payload(self, dimensions: list, exported_response: dict):
"""
construct payload for setting dimension for Journal Entry
"""

dimension_payload = []

for response in exported_response:
Expand Down
3 changes: 0 additions & 3 deletions apps/business_central/exports/purchase_invoice/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ def __construct_purchase_invoice(self, body: PurchaseInvoice, lineitems: List[Pu

return purchase_invoice_payload, batch_purchase_invoice_lineitem_payload, dimensions


def post(self, accounting_export, item, lineitem):
'''
Export the Journal Entry to Business Central.
'''

purchase_invoice_payload, batch_purchase_invoice_payload, dimensions = self.__construct_purchase_invoice(item, lineitem)
logger.info('WORKSPACE_ID: {0}, ACCOUNTING_EXPORT_ID: {1}, PURCHASE_INVOICE_PAYLOAD: {2}, BATCH_PURCHASE_INVOICE_PAYLOAD: {3}'.format(accounting_export.workspace_id, accounting_export.id, purchase_invoice_payload, batch_purchase_invoice_payload))
business_central_credentials = BusinessCentralCredentials.get_active_business_central_credentials(accounting_export.workspace_id)
Expand Down Expand Up @@ -120,7 +118,6 @@ def construct_dimension_set_line_payload(self, dimensions: list, exported_respon
if response.get('body') and 'description2' in response['body'] and 'id' in response['body']
}


for dimension in dimensions:
expense_number = dimension.get('expense_number')
parent_id = document_mapping.get(expense_number)
Expand Down
4 changes: 1 addition & 3 deletions apps/business_central/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import base64
import logging
from typing import Dict, List
from collections import defaultdict

from datetime import datetime
from django.utils import timezone
Expand Down Expand Up @@ -313,7 +312,7 @@ def get_lineitem_by_id(module_type: str, item_id: int):

for dimension_line_payload in dimension_line_payloads:
exported_module_id = dimension_line_payload.pop('exported_module_id')

try:
if export_module_type == 'JOURNAL_ENTRY':
response = self.connection.journal_line_items.post_journal_entry_dimensions(
Expand All @@ -338,7 +337,6 @@ def get_lineitem_by_id(module_type: str, item_id: int):

return exception_response


def post_attachments(
self, ref_type: str, ref_id: str, attachments: List[Dict]
) -> List:
Expand Down
1 change: 0 additions & 1 deletion apps/mappings/imports/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def sync_destination_attributes(self, business_central_attribute_type: str):
business_central_credentials = BusinessCentralCredentials.get_active_business_central_credentials(self.workspace_id)
business_central_connection = BusinessCentralConnector(credentials_object=business_central_credentials, workspace_id=self.workspace_id)


sync_methods = {
'ACCOUNT': business_central_connection.sync_accounts,
'COMPANY': business_central_connection.sync_companies,
Expand Down

0 comments on commit 2ea85f7

Please sign in to comment.