forked from routablehq/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoice.py
More file actions
86 lines (72 loc) · 2.38 KB
/
invoice.py
File metadata and controls
86 lines (72 loc) · 2.38 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
82
83
84
85
86
from six import python_2_unicode_compatible
from .base import QuickbooksBaseObject, Ref, CustomField, Address, EmailAddress, CustomerMemo, QuickbooksManagedObject, \
QuickbooksTransactionEntity, LinkedTxn, LinkedTxnMixin
from .tax import TxnTaxDetail
from .detailline import DetailLine
class DeliveryInfo(QuickbooksBaseObject):
def __init__(self):
super(DeliveryInfo, self).__init__()
self.DeliveryType = ""
self.DeliveryTime = ""
@python_2_unicode_compatible
class Invoice(QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin):
"""
QBO definition: An Invoice represents a sales form where the customer pays for a product or service later.
"""
class_dict = {
"DepartmentRef": Ref,
"CurrencyRef": Ref,
"CustomerRef": Ref,
"ClassRef": Ref,
"SalesTermRef": Ref,
"ShipMethodRef": Ref,
"DepositToAccountRef": Ref,
"BillAddr": Address,
"ShipAddr": Address,
"TxnTaxDetail": TxnTaxDetail,
"BillEmail": EmailAddress,
"CustomerMemo": CustomerMemo,
"DeliveryInfo": DeliveryInfo
}
list_dict = {
"CustomField": CustomField,
"Line": DetailLine,
"LinkedTxn": LinkedTxn,
}
qbo_object_name = "Invoice"
def __init__(self):
super(Invoice, self).__init__()
self.Deposit = 0
self.Balance = 0
self.AllowIPNPayment = True
self.DocNumber = ""
self.PrivateNote = ""
self.DueDate = ""
self.ShipDate = ""
self.TrackingNum = ""
self.TotalAmt = ""
self.ApplyTaxAfterDiscount = False
self.PrintStatus = "NotSet"
self.EmailStatus = "NotSet"
self.ExchangeRate = 1
self.GlobalTaxCalculation = "TaxExcluded"
self.BillAddr = None
self.ShipAddr = None
self.BillEmail = None
self.CustomerRef = None
self.CurrencyRef = None
self.CustomerMemo = None
self.DepartmentRef = None
self.TxnTaxDetail = None
self.DeliveryInfo = None
self.CustomField = []
self.Line = []
self.LinkedTxn = []
def __str__(self):
return str(self.TotalAmt)
def to_linked_txn(self):
linked_txn = LinkedTxn()
linked_txn.TxnId = self.Id
linked_txn.TxnType = "Invoice"
linked_txn.TxnLineId = 1
return linked_txn