Skip to content

Commit

Permalink
Merge pull request #6 from navariltd/dev1
Browse files Browse the repository at this point in the history
fix - Uncomment future code if they decide to use delivery_no for tims
  • Loading branch information
maniamartial authored Nov 1, 2024
2 parents 97a7e22 + 3589ff4 commit 23e9d7e
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ def on_submit(doc: Document, method: str | None = None) -> None:
"Quantity": abs(item.qty),
}
)
# trader_invoice_no = doc.name.split("-", 1)[
# -1]
trader_invoice_no = doc.name.split("-", 1)[
-1]
# Get numbers portion of name, i.e. INV-123456 > 123456
trader_invoice_no = doc.custom_delivery_note_no if doc.custom_delivery_note_no else doc.name.split("-", 1)[-1]
'''If you decide to go with the custom_delivery_note_no field, uncomment the code below'''
# trader_invoice_no = doc.custom_delivery_note_no if doc.custom_delivery_note_no else doc.name.split("-", 1)[-1]
if isinstance(doc.posting_time, str):
# If it's a string
posting_time = doc.posting_time.split(".", 1)[0]
Expand Down Expand Up @@ -250,6 +251,17 @@ def make_tims_request(
},
update_modified=True,
)
'''If you decide to go with the custom_delivery_note_no field, uncomment the code below'''
# invoice_name=frappe.db.get_value("Sales Invoice",{"custom_delivery_note_no":invoice},"name")
# frappe.db.set_value(
# "Sales Invoice",
# invoice_name,
# {
# "custom_cu_invoice_number": invoice_info["ControlCode"],
# "custom_qr_code": qr_code,
# },
# update_modified=True,
# )

except (
requests.exceptions.ConnectionError,
Expand Down

0 comments on commit 23e9d7e

Please sign in to comment.