forked from routablehq/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbill.py
More file actions
82 lines (64 loc) · 2.08 KB
/
bill.py
File metadata and controls
82 lines (64 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from six import python_2_unicode_compatible
from quickbooks.objects.detailline import DetailLine, ItemBasedExpenseLine, AccountBasedExpenseLine, \
TDSLine
from .base import Ref, LinkedTxn, QuickbooksManagedObject, QuickbooksTransactionEntity, \
LinkedTxnMixin
from .tax import TxnTaxDetail
from ..mixins import DeleteMixin
@python_2_unicode_compatible
class Bill(DeleteMixin, QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin):
"""
QBO definition: A Bill entity is an AP transaction representing a request-for-payment from a third party for
goods/services rendered and/or received.
"""
class_dict = {
"SalesTermRef": Ref,
"CurrencyRef": Ref,
"APAccountRef": Ref,
"VendorRef": Ref,
"AttachableRef": Ref,
"DepartmentRef": Ref,
"TxnTaxDetail": TxnTaxDetail,
}
list_dict = {
"Line": DetailLine,
"LinkedTxn": LinkedTxn,
}
detail_dict = {
"ItemBasedExpenseLineDetail": ItemBasedExpenseLine,
"AccountBasedExpenseLineDetail": AccountBasedExpenseLine,
"TDSLineDetail": TDSLine,
}
qbo_object_name = "Bill"
def __init__(self):
super(Bill, self).__init__()
self.DueDate = ""
self.Balance = 0
self.TotalAmt = ""
self.TxnDate = ""
self.DocNumber = ""
self.PrivateNote = ""
self.ExchangeRate = 0
self.GlobalTaxCalculation = None
self.SalesTermRef = None
self.CurrencyRef = None
self.AttachableRef = None
self.VendorRef = None
self.DepartmentRef = None
self.APAccountRef = None
self.LinkedTxn = []
self.Line = []
def __str__(self):
return str(self.Balance)
def to_linked_txn(self):
linked_txn = LinkedTxn()
linked_txn.TxnId = self.Id
linked_txn.TxnType = "Bill"
linked_txn.TxnLineId = 1
return linked_txn
def to_ref(self):
ref = Ref()
ref.name = self.DocNumber
ref.type = self.qbo_object_name
ref.value = self.Id
return ref