Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions bloomstack_core/bloomstack_core/custom/purchase_receipt_item.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,59 @@
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2021-04-28 22:44:11.730666",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Purchase Receipt Item",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "metrc_product_name",
"fieldtype": "Data",
"hidden": 0,
"idx": 7,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"insert_after": "item_name",
"label": "METRC Product Name",
"length": 0,
"modified": "2021-04-28 22:44:11.730666",
"modified_by": "Administrator",
"name": "Purchase Receipt Item-metrc_product_name",
"no_copy": 0,
"options": null,
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
}
],
"custom_perms": [],
Expand Down
11 changes: 5 additions & 6 deletions bloomstack_core/bloomtrace/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ def create_purchase_receipt(transfer):
transfer = frappe.parse_json(transfer)

for item in transfer.get("items", []):
item_exists = frappe.get_all("Item", filters={"metrc_item_name": item.pop("product_name")}, fields=["name", "item_name"])
if item_exists:
item.update({
"item_code": item_exists[0].name,
"item_name": item_exists[0].item_name
})
supplier_item = frappe.db.get_all("Item Supplier", filters={"supplier_part_no": item.get("product_name")}, fields=["parent"])
item.update({
"item_code": supplier_item[0].parent if supplier_item else None,
"metrc_product_name": item.get("product_name")
})

doc = frappe.get_doc({"doctype": "Purchase Receipt"})
doc.update(transfer)
Expand Down