From 87d05daf16a8ab7cd973f2aad33229b9dfc01b19 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Mar 2021 08:02:08 +0100 Subject: [PATCH 1/5] Added Suppliers and manufacturers Added examples for suppliers and manufacturers --- docs/extend/python.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/extend/python.md b/docs/extend/python.md index e689486..fe20165 100644 --- a/docs/extend/python.md +++ b/docs/extend/python.md @@ -127,4 +127,23 @@ item = StockItem.create(api, { 'location': 10, ## PK of a StockLocation already in the database... }) +#### Adding manufacturers and supplier + +We can add manufacturers and suppliers to parts. If we add a manufacturer, a supplier is also mandatory. So we first need to create two companies, ACME (manufacturer) and X-Store (supplier). + +```python +from inventree.company import Company +acme = Company.create(api, { 'name' : 'ACME', 'description':'A Company that makes everything','website':'https://www.acme.bla','is_customer':0,'is_manufacturer':1,'is_supplier':0 }) +xstore = Company.create(api, { 'name' : 'X-Store', 'description':'A really cool online store','website':'https://www.xst.bla','is_customer':0,'is_manufacturer':0,'is_supplier':1 }) +``` + +Please recognize the different flag settings for is_supplier and is_manufacturer. Now lets add those to our couch: + +```python +from inventree.company import SupplierPart +SupplierPart.create(api,{'part':couch.pk,'supplier':xstore.pk,'SKU':'some_code','manufacturer':acme.pk}) +``` + +Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store. Her we can add price tags later on. + ``` From 9b9bcb941e0a8666b39aa66ce569a380ebb3833f Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Mar 2021 08:16:22 +0100 Subject: [PATCH 2/5] Update python.md Formatting --- docs/extend/python.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/extend/python.md b/docs/extend/python.md index fe20165..6cca6b4 100644 --- a/docs/extend/python.md +++ b/docs/extend/python.md @@ -126,6 +126,7 @@ item = StockItem.create(api, { 'notes': 'A stack of couches', 'location': 10, ## PK of a StockLocation already in the database... }) +``` #### Adding manufacturers and supplier From 9e7278884536b2e62f80195f5b2cbbe895b487bf Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Mar 2021 08:19:03 +0100 Subject: [PATCH 3/5] Update python.md Formatting --- docs/extend/python.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/extend/python.md b/docs/extend/python.md index 6cca6b4..fa1849b 100644 --- a/docs/extend/python.md +++ b/docs/extend/python.md @@ -134,15 +134,34 @@ We can add manufacturers and suppliers to parts. If we add a manufacturer, a sup ```python from inventree.company import Company -acme = Company.create(api, { 'name' : 'ACME', 'description':'A Company that makes everything','website':'https://www.acme.bla','is_customer':0,'is_manufacturer':1,'is_supplier':0 }) -xstore = Company.create(api, { 'name' : 'X-Store', 'description':'A really cool online store','website':'https://www.xst.bla','is_customer':0,'is_manufacturer':0,'is_supplier':1 }) +acme = Company.create(api, { + 'name' : 'ACME', + 'description':'A Company that makes everything', + 'website':'https://www.acme.bla', + 'is_customer':0, + 'is_manufacturer':1, + 'is_supplier':0 +}) +xstore = Company.create(api, { + 'name' : 'X-Store', + 'description':'A really cool online store', + 'website':'https://www.xst.bla', + 'is_customer':0, + 'is_manufacturer':0, + 'is_supplier':1 +}) ``` Please recognize the different flag settings for is_supplier and is_manufacturer. Now lets add those to our couch: ```python from inventree.company import SupplierPart -SupplierPart.create(api,{'part':couch.pk,'supplier':xstore.pk,'SKU':'some_code','manufacturer':acme.pk}) +SupplierPart.create(api,{ + 'part':couch.pk, + 'supplier':xstore.pk, + 'SKU':'some_code', + 'manufacturer':acme.pk +}) ``` Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store. Her we can add price tags later on. From 1a0d017eb4362b93d825aff1bd4db59c1494150f Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Mar 2021 08:20:35 +0100 Subject: [PATCH 4/5] Update python.md Formatting --- docs/extend/python.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/extend/python.md b/docs/extend/python.md index fa1849b..74b8f24 100644 --- a/docs/extend/python.md +++ b/docs/extend/python.md @@ -134,6 +134,9 @@ We can add manufacturers and suppliers to parts. If we add a manufacturer, a sup ```python from inventree.company import Company + +... + acme = Company.create(api, { 'name' : 'ACME', 'description':'A Company that makes everything', @@ -156,6 +159,9 @@ Please recognize the different flag settings for is_supplier and is_manufacturer ```python from inventree.company import SupplierPart + +... + SupplierPart.create(api,{ 'part':couch.pk, 'supplier':xstore.pk, @@ -165,5 +171,3 @@ SupplierPart.create(api,{ ``` Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store. Her we can add price tags later on. - -``` From edaa19973b48e2f5248d7a366fe4fbc6278950e3 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Mar 2021 08:23:08 +0100 Subject: [PATCH 5/5] Update python.md formatting --- docs/extend/python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/extend/python.md b/docs/extend/python.md index 74b8f24..68b25c5 100644 --- a/docs/extend/python.md +++ b/docs/extend/python.md @@ -170,4 +170,4 @@ SupplierPart.create(api,{ }) ``` -Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store. Her we can add price tags later on. +Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store.