Skip to content

Commit ccfacef

Browse files
committed
Fix bug in product list resource (#233)
* Fix bug: unexpected argument 'defaultgroups' * Fix string-int comparison and update documentation
1 parent d8f4d50 commit ccfacef

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

importer/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,12 @@ The coverage report `coverage.html` will be at the working directory
156156
- The csv_file containing the exported resources is labelled using the current time, to know when the resources were exported for example, csv/exports/2024-02-21-12-21-export_Location.csv
157157

158158
### 10. Import products from openSRP 1
159-
- Run `python3 main.py --csv_file csv/import/product.csv --setup products --log_level info`
159+
- Run `python3 main.py --csv_file csv/import/product.csv --setup products --list_resource_id 123 --log_level info`
160160
- See example csv [here](/importer/csv/import/product.csv)
161161
- This creates a Group resource for each product imported, a Binary resource for any products with an image, and a List resource with references to all the Group and Binary resources created
162162
- The first two columns __name__ and __active__ is the minimum required
163163
- The last column __imageSourceUrl__ contains a url to the product image. If this source requires authentication, then you need to provide the `product_access_token` in the config file. The image is added as a binary resource and referenced in the product's Group resource
164+
- You can pass in a `list_resource_id` to be used as the identifier for the List resource, or you can leave it empty and a random uuid will be generated
164165

165166
### 11. Import inventories from openSRP 1
166167
- Run `python3 main.py --csv_file csv/import/inventory.csv --setup inventories --log_level info`

importer/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ def main(
19321932
list_resource_id = str(uuid.uuid5(uuid.NAMESPACE_DNS, csv_file))
19331933

19341934
current_version = get_resource(list_resource_id, "List")
1935-
method = "create" if current_version == 0 else "update"
1935+
method = "create" if current_version == str(0) else "update"
19361936
resource = [["Supply Inventory List", "current", method, list_resource_id]]
19371937
result_payload = build_payload(
19381938
"List", resource, "json_payloads/product_list_payload.json")

0 commit comments

Comments
 (0)