Skip to content

Commit

Permalink
Allocation Entry API support (#81)
Browse files Browse the repository at this point in the history
* Allocation Entry API support

* Version bump up

* Implemented Allocation entry API

* Add delete api for all dimensions

* remove line

* adding compulsory fields

* added allocations api

* allocations api

* allocations api

* change in allocation_entry

* comment resolved

* comment resolved

* Added fields to allocation
  • Loading branch information
Ashutosh619-sudo authored Jul 18, 2024
1 parent a642708 commit 8163243
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 3 deletions.
6 changes: 5 additions & 1 deletion sageintacctsdk/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from .revenue_recognition_schedule_entries import RevRecScheduleEntries
from .cost_types import CostTypes
from .order_entry_transactions import OrderEntryTransactions
from .allocation_entry import AllocationEntry
from .allocations import Allocations

__all__ = [
'ApiBase',
Expand All @@ -57,8 +59,9 @@
'Customers',
'Items',
'APPayments',
'AllocationEntry',
'ARInvoices',
'ARPayments'
'ARPayments',
'Reimbursements',
'CheckingAccounts',
'SavingsAccounts',
Expand All @@ -75,4 +78,5 @@
'RevRecScheduleEntries',
'CostTypes',
'OrderEntryTransactions',
'Allocations'
]
25 changes: 25 additions & 0 deletions sageintacctsdk/apis/allocation_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from .api_base import ApiBase

class AllocationEntry(ApiBase):
"""Class for Allocation Entry APIs."""
def __init__(self):
ApiBase.__init__(self, dimension='allocationentry')


def get_all_generator(self, field: str = None, value: str = None, fields: list = None, updated_at: str = None, order_by_field: str = None, order: str = None):

"""
Get all the allocation entries.
"""

allocation_entries_fields = ['ALLOCATIONID', 'ALLOCATIONKEY', 'LOCATIONID', 'DEPARTMENTID', 'PROJECTID',
'CUSTOMERID', 'ITEMID', 'TASKID', 'COSTTYPEID', 'CLASSID']

fields = self.get_lookup()
if fields:
fields = fields['Type']['Relationships']['Relationship']

for allocation_field in fields:
allocation_entries_fields.append(allocation_field['RELATEDBY'])

yield from super().get_all_generator(fields=allocation_entries_fields, field=field, value=value)
6 changes: 6 additions & 0 deletions sageintacctsdk/apis/allocations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .api_base import ApiBase

class Allocations(ApiBase):
"""Class for Allocation Entry APIs."""
def __init__(self):
ApiBase.__init__(self, dimension='ALLOCATION')
14 changes: 14 additions & 0 deletions sageintacctsdk/apis/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,17 @@ def get_lookup(self):

data = {'lookup': {'object': self.__dimension}}
return self.format_and_send_request(data)['data']

def delete(self, key):
"""
Delete the dimension with the given key
"""

data = {
'delete': {
'object': self.__dimension,
'keys': str(key)
}
}

return self.format_and_send_request(data=data)
11 changes: 11 additions & 0 deletions sageintacctsdk/apis/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,5 +696,16 @@
'TASKDIMKEY',
'TASKID',
'TASKNAME'
],
'ALLOCATION': [
'RECORDNO',
'ALLOCATIONID',
'STATUS',
'DESCRIPTION',
'TYPE',
'WHENCREATED',
'WHENMODIFIED',
'CREATEDBY',
'MODIFIEDBY'
]
}
12 changes: 11 additions & 1 deletion sageintacctsdk/sageintacctsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Vendors, Bills, Projects, Departments, ChargeCardAccounts, ChargeCardTransactions, Customers, Items,\
APPayments, Reimbursements, CheckingAccounts, SavingsAccounts, Tasks, ExpensePaymentTypes, Dimensions,\
DimensionValues, LocationEntities, ARInvoices, ARPayments, TaxDetails, GLDetail, Classes, JournalEntries,\
RevRecSchedules, RevRecScheduleEntries, CostTypes, OrderEntryTransactions
RevRecSchedules, RevRecScheduleEntries, CostTypes, OrderEntryTransactions, Allocations, AllocationEntry


class SageIntacctSDK:
Expand Down Expand Up @@ -52,6 +52,7 @@ def __init__(self, sender_id: str, sender_password: str, user_id: str,
self.customers = Customers()
self.items = Items()
self.ap_payments = APPayments()
self.allocation_entry = AllocationEntry()
self.ar_invoices = ARInvoices()
self.ar_payments = ARPayments()
self.reimbursements = Reimbursements()
Expand All @@ -70,6 +71,7 @@ def __init__(self, sender_id: str, sender_password: str, user_id: str,
self.rev_rec_schedule_entries = RevRecScheduleEntries()
self.cost_types = CostTypes()
self.order_entry_transactions = OrderEntryTransactions()
self.allocations = Allocations()
self.update_sender_id()
self.update_sender_password()
self.update_session_id()
Expand Down Expand Up @@ -115,6 +117,8 @@ def update_sender_id(self):
self.rev_rec_schedule_entries.set_sender_id(self.__sender_id)
self.cost_types.set_sender_id(self.__sender_id)
self.order_entry_transactions.set_sender_id(self.__sender_id)
self.allocation_entry.set_sender_id(self.__sender_id)
self.allocations.set_sender_id(self.__sender_id)

def update_sender_password(self):
"""
Expand Down Expand Up @@ -156,6 +160,8 @@ def update_sender_password(self):
self.rev_rec_schedule_entries.set_sender_password(self.__sender_password)
self.cost_types.set_sender_password(self.__sender_password)
self.order_entry_transactions.set_sender_password(self.__sender_password)
self.allocation_entry.set_sender_password(self.__sender_password)
self.allocations.set_sender_password(self.__sender_password)

def update_session_id(self):
"""
Expand Down Expand Up @@ -199,6 +205,8 @@ def update_session_id(self):
self.rev_rec_schedule_entries.set_session_id(self.__session_id)
self.cost_types.set_session_id(self.__session_id)
self.order_entry_transactions.set_session_id(self.__session_id)
self.allocation_entry.set_session_id(self.__session_id)
self.allocations.set_session_id(self.__session_id)

def update_show_private(self):
"""
Expand Down Expand Up @@ -240,3 +248,5 @@ def update_show_private(self):
self.rev_rec_schedule_entries.set_show_private(self.__show_private)
self.cost_types.set_show_private(self.__show_private)
self.order_entry_transactions.set_show_private(self.__show_private)
self.allocation_entry.set_show_private(self.__show_private)
self.allocations.set_show_private(self.__show_private)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name='sageintacctsdk',
version='1.21.1',
version='1.22.0',
author='Ashwin T',
author_email='[email protected]',
description='Python SDK for accessing Sage Intacct APIs',
Expand Down

0 comments on commit 8163243

Please sign in to comment.