forked from routablehq/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.py
More file actions
79 lines (65 loc) · 2.49 KB
/
item.py
File metadata and controls
79 lines (65 loc) · 2.49 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
from six import python_2_unicode_compatible
from .base import Ref, QuickbooksManagedObject, QuickbooksTransactionEntity
@python_2_unicode_compatible
class Item(QuickbooksManagedObject, QuickbooksTransactionEntity):
"""
QBO definition: An item is a thing that your company buys, sells, or re-sells,
such as products and services. An item is shown as a line on an invoice or other sales
form. The Item.Type attribute, which specifies how the item is used, has one of
the following values:
Inventory - This type tracks merchandise that your business purchases, stocks,
and re-sells as inventory. QuickBooks tracks the current number of inventory items in stock,
cost of goods sold, and the asset value of the inventory after the purchase and sale
of every item.
Service - This type tracks services that you charge on the purchase and tracks
merchandise you sell and buy that is not tracked as inventory. For example, specialized
labor, consulting hours, and professional fees.
"""
class_dict = {
"AssetAccountRef": Ref,
"ExpenseAccountRef": Ref,
"IncomeAccountRef": Ref,
"ParentRef": Ref,
"SalesTaxCodeRef": Ref,
"PurchaseTaxCodeRef": Ref,
}
qbo_object_name = "Item"
def __init__(self):
super(Item, self).__init__()
self.Name = ""
self.Description = ""
self.Active = True
self.SubItem = False
self.FullyQualifiedName = "" # Readonly
self.Taxable = False
self.SalesTaxIncluded = None
self.UnitPrice = 0
self.Type = ""
self.Level = None # Readonly
self.PurchaseDesc = None
self.PurchaseTaxIncluded = None
self.PurchaseCost = None
self.TrackQtyOnHand = False
self.QtyOnHand = None
self.InvStartDate = None
self.AssetAccountRef = None
self.ExpenseAccountRef = None
self.IncomeAccountRef = None
self.SalesTaxCodeRef = None
self.ParentRef = None
self.PurchaseTaxCodeRef = None
# These fields are for minor version 3
self.AbatementRate = None
self.ReverseChargeRate = None
self.ServiceType = None
self.ItemCategoryType = None
# These fields are for minor version 4
self.Sku = None
def __str__(self):
return self.Name
def to_ref(self):
ref = Ref()
ref.name = self.Name
ref.type = self.qbo_object_name
ref.value = self.Id
return ref