From ef111206462fc3834b0eeb5bf9cedf1ec6d8b4ac Mon Sep 17 00:00:00 2001 From: Vikas8600 Date: Wed, 19 Apr 2023 15:05:44 +0530 Subject: [PATCH] feat: Delivery Note button --- ecommerce_integrations/unicommerce/delivery_note.py | 3 +++ .../unicommerce_settings/unicommerce_settings.js | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ecommerce_integrations/unicommerce/delivery_note.py b/ecommerce_integrations/unicommerce/delivery_note.py index 85b90bcd..618e590a 100644 --- a/ecommerce_integrations/unicommerce/delivery_note.py +++ b/ecommerce_integrations/unicommerce/delivery_note.py @@ -37,7 +37,10 @@ "RETURN_ACKNOWLEDGED", "MERGED", ] + import time + +@frappe.whitelist() def prepare_delivery_note(): try: time.sleep(15) diff --git a/ecommerce_integrations/unicommerce/doctype/unicommerce_settings/unicommerce_settings.js b/ecommerce_integrations/unicommerce/doctype/unicommerce_settings/unicommerce_settings.js index 4f4344c3..70d0bcb9 100644 --- a/ecommerce_integrations/unicommerce/doctype/unicommerce_settings/unicommerce_settings.js +++ b/ecommerce_integrations/unicommerce/doctype/unicommerce_settings/unicommerce_settings.js @@ -33,6 +33,19 @@ frappe.ui.form.on("Unicommerce Settings", { __("Sync Now") ); }); + + frm.add_custom_button(__("Delivery Note"), () => { + frappe.call({ + method: + "ecommerce_integrations.unicommerce.delivery_note.prepare_delivery_note", + callback: (r) => { + frappe.msgprint("Intiated Delivery Note.") + }, + }); + }, + __("Sync Now") + ); + }, onload: function (frm) {