1- from base import QuickbooksBaseObject , Ref , QuickbooksManagedObject , LinkedTxnMixin
1+ from base import QuickbooksBaseObject , Ref , QuickbooksManagedObject , QuickbooksTransactionEntity , LinkedTxnMixin , \
2+ LinkedTxn , Address , CustomField , MarkupInfo
3+
4+ from tax import TxnTaxDetail
25
36
47class AccountBasedExpenseLineDetail (QuickbooksBaseObject ):
@@ -21,27 +24,63 @@ def __unicode__(self):
2124 return self .BillableStatus
2225
2326
27+ class ItemBasedExpenseLineDetail (QuickbooksBaseObject ):
28+
29+ class_dict = {
30+ "ItemRef" : Ref ,
31+ "ClassRef" : Ref ,
32+ "PriceLevelRef" : Ref ,
33+ "TaxCodeRef" : Ref ,
34+ "CustomerRef" : Ref ,
35+ "MarkupInfo" : MarkupInfo
36+ }
37+
38+ def __init__ (self ):
39+
40+ self .UnitPrice = 0
41+ self .Qty = 0
42+ self .BillableStatus = ""
43+ self .TaxInclusiveAmt = 0
44+
45+ self .ItemRef = None
46+ self .ClassRef = None
47+ self .PriceLevelRef = None
48+ self .TaxCodeRef = None
49+ self .CustomerRef = None
50+ self .MarkupInfo = None
51+
52+
2453class PurchaseLine (QuickbooksBaseObject ):
2554 class_dict = {
2655 "AccountBasedExpenseLineDetail" : Ref ,
56+ "ItemBasedExpenseLineDetail" : ItemBasedExpenseLineDetail ,
2757 }
2858
29- list_dict = {}
59+ list_dict = {
60+ "LinkedTxn" : LinkedTxn ,
61+ "CustomField" : CustomField ,
62+ }
3063
3164 def __init__ (self ):
3265 super (PurchaseLine , self ).__init__ ()
66+ self .Id = 0
67+ self .LineNum = 0
68+ self .Description = ""
3369 self .Amount = 0
34- self .DetailType = ""
70+ self .DetailType = "ItemBasedExpenseLineDetail "
3571
3672 self .TaxCodeRef = None
3773 self .AccountRef = None
74+ self .ItemBasedExpenseLineDetail = None
75+
76+ self .LinkedTxn = []
3877 self .AccountBasedExpenseLineDetail = []
3978
4079 def __unicode__ (self ):
4180 return str (self .Amount )
4281
4382
44- class Purchase (QuickbooksManagedObject , LinkedTxnMixin ):
83+ class Purchase (QuickbooksManagedObject , QuickbooksTransactionEntity , LinkedTxnMixin ):
4584 """
4685 QBO definition: This entity represents expenses, such as a purchase made from a vendor.
4786 There are three types of Purchases: Cash, Check, and Credit Card.
@@ -59,20 +98,44 @@ class Purchase(QuickbooksManagedObject, LinkedTxnMixin):
5998 class_dict = {
6099 "AccountRef" : Ref ,
61100 "EntityRef" : Ref ,
101+ "DepartmentRef" : Ref ,
102+ "CurrencyRef" : Ref ,
103+ "PaymentMethodRef" : Ref ,
104+ "RemitToAddr" : Address ,
105+ "TxnTaxDetail" : TxnTaxDetail
62106 }
63107
64108 list_dict = {
65- "Line" : PurchaseLine
109+ "Line" : PurchaseLine ,
110+ "LinkedTxn" : LinkedTxn ,
66111 }
67112
68113 qbo_object_name = "Purchase"
69114
70115 def __init__ (self ):
71116 super (Purchase , self ).__init__ ()
117+ self .DocNumber = ""
118+ self .TxnDate = ""
119+ self .ExchangeRate = 1
120+ self .PrivateNote = ""
72121 self .PaymentType = ""
73122 self .Credit = False
74123 self .TotalAmt = 0
75- self .TxnDate = ""
124+ self .PrintStatus = "NeedToPrint"
125+ self .PurchaseEx = ""
126+ self .TxnSource = ""
127+ self .GlobalTaxCalculation = "TaxExcluded"
128+
129+ self .TxnTaxDetail = None
130+ self .DepartmentRef = None
131+ self .AccountRef = None
132+ self .EnitityRef = None
133+ self .CurrencyRef = None
134+ self .PaymentMethodRef = None
135+ self .RemitToAddr = None
136+
137+ self .Line = []
138+ self .LinkedTxn = []
76139
77140 def __unicode__ (self ):
78141 return str (self .TotalAmt )
0 commit comments