Skip to content

Commit 6ee2a44

Browse files
authored
Merge pull request #2 from patriotresearch/HB-431-add-fields-to-part-and-product-lookups
HB-431 add fields to part and product lookups
2 parents b5dbc6a + db55a6f commit 6ee2a44

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

fishbowl/api.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,36 @@
4141
"WHERE p.productincltypeid = 2 AND p.customerincltypeid = 3"
4242
)
4343

44-
PRODUCTS_SQL = (
45-
"SELECT P.*, PART.STDCOST AS StandardCost, PART.TYPEID as TypeID "
46-
"{ci_fields} FROM PRODUCT P "
47-
"INNER JOIN PART ON P.PARTID = PART.ID {custom_joins}"
48-
)
49-
50-
51-
PARTS_SQL = (
52-
"SELECT id, num, stdCost as StandardCost, description, typeID, "
53-
"dateLastModified, dateCreated, len, serializedFlag "
54-
"FROM Part"
55-
)
44+
# https://www.fishbowlinventory.com/files/databasedictionary/2017/tables/product.html
45+
PRODUCTS_SQL = """
46+
SELECT
47+
P.*,
48+
PART.STDCOST AS StandardCost,
49+
PART.TYPEID as TypeID
50+
{ci_fields}
51+
FROM PRODUCT P
52+
INNER JOIN PART ON P.PARTID = PART.ID
53+
{custom_joins}
54+
"""
55+
56+
# https://www.fishbowlinventory.com/files/databasedictionary/2017/tables/part.html
57+
PARTS_SQL = """
58+
SELECT
59+
id,
60+
num,
61+
stdCost as StandardCost,
62+
description,
63+
typeID,
64+
dateLastModified,
65+
dateCreated,
66+
len,
67+
weight,
68+
height,
69+
width,
70+
revision,
71+
serializedFlag
72+
FROM Part
73+
"""
5674

5775
SERIAL_NUMBER_SQL = (
5876
"SELECT sn.id, sn.serialId, sn.serialNum, p.num as PartNum, "

fishbowl/objects.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,12 @@ class Part(FishbowlObject):
348348
("SerializedFlag", fishbowl_boolean),
349349
("TrackingFlag", fishbowl_boolean),
350350
("UsedFlag", fishbowl_boolean),
351-
("Weight", int),
351+
("Weight", decimal.Decimal),
352352
("WeightUOMID", int),
353-
("Width", int),
354-
("Height", int),
355-
("Len", int),
353+
("Width", decimal.Decimal),
354+
("Height", decimal.Decimal),
355+
("Len", decimal.Decimal),
356+
("Revision", None),
356357
("SizeUOMID", int),
357358
("CustomFields", [CustomField]),
358359
("VendorPartNums", None),
@@ -374,11 +375,11 @@ class Product(FishbowlObject):
374375
("UOM", UOM),
375376
("DefaultSOItemType", None),
376377
("DisplayType", None),
377-
("Weight", int),
378+
("Weight", decimal.Decimal),
378379
("WeightUOMID", int),
379-
("Width", int),
380-
("Height", int),
381-
("Len", int),
380+
("Width", decimal.Decimal),
381+
("Height", decimal.Decimal),
382+
("Len", decimal.Decimal),
382383
("SizeUOMID", int),
383384
("SellableInOtherUOMFlag", fishbowl_boolean),
384385
("ActiveFlag", fishbowl_boolean),

0 commit comments

Comments
 (0)