Skip to content

Commit

Permalink
Merge branch 'staging' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil28297 committed May 19, 2021
2 parents 9b9d534 + 4f32b83 commit 55c9e7f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bloomstack_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

__version__ = '2.2.0'
__version__ = '2.2.1'
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

0 comments on commit 55c9e7f

Please sign in to comment.