Skip to content

Commit 772c2bf

Browse files
committed
Updated invoice. Moved common objects from invoice and estimate to detailline.
1 parent 575f08a commit 772c2bf

File tree

7 files changed

+254
-292
lines changed

7 files changed

+254
-292
lines changed

quickbooks/objects/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,6 @@ def __init__(self):
123123

124124
def __unicode__(self):
125125
return self.Value
126+
127+
128+

quickbooks/objects/detailline.py

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
from base import QuickbooksBaseObject, Ref, CustomField, LinkedTxn
2+
3+
4+
class DetailLine(QuickbooksBaseObject):
5+
list_dict = {
6+
"LinkedTxn": LinkedTxn,
7+
"CustomField": CustomField,
8+
}
9+
10+
def __init__(self):
11+
super(DetailLine, self).__init__()
12+
self.Id = 0
13+
self.LineNum = 0
14+
self.Description = ""
15+
self.Amount = 0
16+
self.DetailType = ""
17+
self.LinkedTxn = []
18+
self.CustomField = []
19+
20+
def __unicode__(self):
21+
return "[{0}] {1} {2}".format(self.LineNum, self.Description, self.Amount)
22+
23+
24+
class DiscountOverride(QuickbooksBaseObject):
25+
class_dict = {
26+
"DiscountRef": Ref,
27+
"DiscountAccountRef": Ref,
28+
}
29+
30+
qbo_object_name = "DiscountOverride"
31+
32+
def __init__(self):
33+
super(DiscountOverride, self).__init__()
34+
self.PercentBased = False
35+
self.DiscountPercent = 0
36+
self.DiscountRef = None
37+
self.DiscountAccountRef = None
38+
39+
40+
class DiscountLineDetail(QuickbooksBaseObject):
41+
class_dict = {
42+
"Discount": DiscountOverride,
43+
"ClassRef": Ref,
44+
"TaxCodeRef": Ref,
45+
}
46+
47+
def __init__(self):
48+
super(DiscountLineDetail, self).__init__()
49+
50+
self.Discount = None
51+
self.ClassRef = None
52+
self.TaxCodeRef = None
53+
54+
55+
class DiscountLine(DetailLine):
56+
class_dict = {
57+
"DiscountLineDetail": DiscountLineDetail
58+
}
59+
60+
def __init__(self):
61+
super(DiscountLine, self).__init__()
62+
self.DetailType = "DiscountLineDetail"
63+
self.DiscountLineDetail = None
64+
65+
66+
class SubtotalLineDetail(QuickbooksBaseObject):
67+
class_dict = {
68+
"ItemRef": Ref
69+
}
70+
71+
def __init__(self):
72+
super(SubtotalLineDetail, self).__init__()
73+
self.ItemRef = None
74+
75+
76+
class SubtotalLine(DetailLine):
77+
class_dict = {
78+
"SubtotalLineDetail": SubtotalLineDetail
79+
}
80+
81+
def __init__(self):
82+
super(SubtotalLine, self).__init__()
83+
self.DetailType = "SubtotalLineDetail"
84+
self.SubtotalLineDetail = None
85+
86+
87+
class DescriptionLineDetail(QuickbooksBaseObject):
88+
class_dict = {
89+
"TaxCodeRef": Ref
90+
}
91+
92+
def __init__(self):
93+
super(DescriptionLineDetail, self).__init__()
94+
self.ServiceDate = ""
95+
self.TaxCodeRef = None
96+
97+
98+
class DescriptionLine(DetailLine):
99+
class_dict = {
100+
"DescriptionLineDetail": DescriptionLineDetail
101+
}
102+
103+
def __init__(self):
104+
super(DescriptionLine, self).__init__()
105+
self.DetailType = "DescriptionOnly"
106+
self.DescriptionLineDetail = None
107+
108+
109+
class SalesItemLineDetail(QuickbooksBaseObject):
110+
class_dict = {
111+
"ItemRef": Ref,
112+
"ClassRef": Ref,
113+
"TaxCodeRef": Ref,
114+
"PriceLevelRef": Ref,
115+
}
116+
117+
def __init__(self):
118+
super(SalesItemLineDetail, self).__init__()
119+
self.UnitPrice = 0
120+
self.Qty = 0
121+
self.MarkupInfo = ""
122+
self.ServiceDate = ""
123+
self.TaxInclusiveAmt = 0
124+
125+
def __unicode__(self):
126+
return str(self.UnitPrice)
127+
128+
129+
class SaleItemLine(DetailLine):
130+
class_dict = {
131+
"SalesItemLineDetail": SalesItemLineDetail
132+
}
133+
134+
def __init__(self):
135+
super(SaleItemLine, self).__init__()
136+
self.DetailType = "SalesItemLineDetail"
137+
self.SalesItemLineDetail = None

quickbooks/objects/estimate.py

Lines changed: 2 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,7 @@
11
from base import QuickbooksBaseObject, CustomField, Ref, CustomerMemo, Address, EmailAddress, QuickbooksManagedObject, \
22
LinkedTxnMixin, QuickbooksTransactionEntity, LinkedTxn
33
from tax import TxnTaxDetail
4-
5-
6-
class EstimateLine(QuickbooksBaseObject):
7-
list_dict = {
8-
"LinkedTxn": LinkedTxn,
9-
"CustomField": CustomField,
10-
}
11-
12-
def __init__(self):
13-
super(EstimateLine, self).__init__()
14-
self.Id = 0
15-
self.LineNum = 0
16-
self.Description = ""
17-
self.Amount = 0
18-
self.DetailType = ""
19-
self.LinkedTxn = []
20-
self.CustomField = []
21-
22-
def __unicode__(self):
23-
return str(self.Amount)
24-
25-
26-
class DiscountOverride(QuickbooksBaseObject):
27-
class_dict = {
28-
"DiscountRef": Ref,
29-
"DiscountAccountRef": Ref,
30-
}
31-
32-
qbo_object_name = "DiscountOverride"
33-
34-
def __init__(self):
35-
super(DiscountOverride, self).__init__()
36-
self.PercentBased = False
37-
self.DiscountPercent = 0
38-
self.DiscountRef = None
39-
self.DiscountAccountRef = None
40-
41-
42-
class DiscountLineDetail(QuickbooksBaseObject):
43-
class_dict = {
44-
"Discount": DiscountOverride,
45-
"ClassRef": Ref,
46-
"TaxCodeRef": Ref,
47-
}
48-
49-
def __init__(self):
50-
super(DiscountLineDetail, self).__init__()
51-
52-
self.Discount = None
53-
self.ClassRef = None
54-
self.TaxCodeRef = None
55-
56-
57-
class DiscountLine(EstimateLine):
58-
class_dict = {
59-
"DiscountLineDetail": DiscountLineDetail
60-
}
61-
62-
def __init__(self):
63-
super(DiscountLine, self).__init__()
64-
self.DetailType = "DiscountLineDetail"
65-
self.DiscountLineDetail = None
66-
67-
68-
class SubtotalLineDetail(QuickbooksBaseObject):
69-
class_dict = {
70-
"ItemRef": Ref
71-
}
72-
73-
def __init__(self):
74-
super(SubtotalLineDetail, self).__init__()
75-
self.ItemRef = None
76-
77-
78-
class SubtotalLine(EstimateLine):
79-
class_dict = {
80-
"SubtotalLineDetail": SubtotalLineDetail
81-
}
82-
83-
def __init__(self):
84-
super(SubtotalLine, self).__init__()
85-
self.DetailType = "SubtotalLineDetail"
86-
self.SubtotalLineDetail = None
87-
88-
89-
class DescriptionLineDetail(QuickbooksBaseObject):
90-
class_dict = {
91-
"TaxCodeRef": Ref
92-
}
93-
94-
def __init__(self):
95-
super(DescriptionLineDetail, self).__init__()
96-
self.ServiceDate = ""
97-
self.TaxCodeRef = None
98-
99-
100-
class DescriptionLine(EstimateLine):
101-
class_dict = {
102-
"DescriptionLineDetail": DescriptionLineDetail
103-
}
104-
105-
def __init__(self):
106-
super(DescriptionLine, self).__init__()
107-
self.DetailType = "DescriptionOnly"
108-
self.DescriptionLineDetail = None
109-
110-
111-
class SalesItemLineDetail(QuickbooksBaseObject):
112-
class_dict = {
113-
"ItemRef": Ref,
114-
"ClassRef": Ref,
115-
"TaxCodeRef": Ref,
116-
"PriceLevelRef": Ref,
117-
}
118-
119-
def __init__(self):
120-
super(SalesItemLineDetail, self).__init__()
121-
self.UnitPrice = 0
122-
self.Qty = 0
123-
self.MarkupInfo = ""
124-
self.ServiceDate = ""
125-
self.TaxInclusiveAmt = 0
126-
127-
def __unicode__(self):
128-
return str(self.UnitPrice)
129-
130-
131-
class SaleItemLine(EstimateLine):
132-
class_dict = {
133-
"SalesItemLineDetail": SalesItemLineDetail
134-
}
135-
136-
def __init__(self):
137-
super(SaleItemLine, self).__init__()
138-
self.DetailType = "SalesItemLineDetail"
139-
self.SalesItemLineDetail = None
4+
from detailline import DetailLine
1405

1416

1427
class Estimate(QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin):
@@ -162,7 +27,7 @@ class Estimate(QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMi
16227
list_dict = {
16328
"CustomField": CustomField,
16429
"LinkedTxn": LinkedTxn,
165-
"Line": EstimateLine,
30+
"Line": DetailLine,
16631
}
16732

16833
qbo_object_name = "Estimate"

0 commit comments

Comments
 (0)