Skip to content

Commit

Permalink
fix: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikas8600 committed May 13, 2023
1 parent 1eba131 commit 13928e9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions ecommerce_integrations/unicommerce/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,20 @@ def _create_sales_invoices(unicommerce_order, sales_order, client: UnicommerceAP
facility_code = sales_order.get(FACILITY_CODE_FIELD)
shipping_packages = unicommerce_order["shippingPackages"]
for package in shipping_packages:
# This code was added because the log statement below was being executed every time.
invoice_data = client.get_sales_invoice(
shipping_package_code=package["code"], facility_code=facility_code
)
existing_si = frappe.db.get_value(
"Sales Invoice", {INVOICE_CODE_FIELD: invoice_data["invoice"]["code"]}
)
if existing_si:
continue
try:
log = create_unicommerce_log(method="create_sales_invoice", make_new=True)
frappe.flags.request_id = log.name

# This code was added because the log statement below was being executed every time.
invoice_data = client.get_sales_invoice(
shipping_package_code=package["code"], facility_code=facility_code
)
existing_si = frappe.db.get_value(
"Sales Invoice", {INVOICE_CODE_FIELD: invoice_data["invoice"]["code"]}
)
if existing_si:
continue

log = create_unicommerce_log(method="create_sales_invoice", make_new=True)
frappe.flags.request_id = log.name

warehouse_allocations = _get_warehouse_allocations(sales_order)
create_sales_invoice(
invoice_data["invoice"],
Expand Down

0 comments on commit 13928e9

Please sign in to comment.