Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sync stock entry #570

Merged
merged 1 commit into from
Mar 24, 2021
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
6 changes: 2 additions & 4 deletions bloomstack_core/compliance/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
def create_package_from_stock(stock_entry, method):
# TODO: Handle non-manufacture Stock Entries for intermediate packages
stock_entry_purpose = frappe.db.get_value("Stock Entry Type", stock_entry.stock_entry_type, "purpose")
if stock_entry_purpose not in ["Manufacture", "Repack"]:
return

make_integration_request("Stock Entry", stock_entry.name)
if stock_entry_purpose in ["Manufacture", "Repack"]:
make_integration_request("Stock Entry", stock_entry.name)


def adjust_package_from_stock(stock_entry, method):
Expand Down
18 changes: 5 additions & 13 deletions bloomstack_core/hook_events/stock_reconciliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@

import frappe
from frappe.utils import cstr, today
from bloomstack_core.bloomtrace import get_bloomtrace_client
from bloomstack_core.bloomtrace import get_bloomtrace_client, make_integration_request


def create_integration_request(doc, method):
if doc.items[0].package_tag:
integration_request = frappe.new_doc("Integration Request")
integration_request.update({
"integration_type": "Remote",
"integration_request_service": "BloomTrace",
"method": "POST",
"status": "Queued",
"endpoint": "adjust",
"reference_doctype": "Stock Reconciliation",
"reference_docname": doc.name
})
integration_request.save(ignore_permissions=True)
for item in doc.items:
if item.package_tag:
make_integration_request("Stock Reconciliation", doc.name)
break

def execute_bloomtrace_integration_request():
frappe_client = get_bloomtrace_client()
Expand Down