diff --git a/sinai_spark/hooks.py b/sinai_spark/hooks.py
index 93c5a0c..a9df6f4 100644
--- a/sinai_spark/hooks.py
+++ b/sinai_spark/hooks.py
@@ -28,7 +28,7 @@
# page_js = {"page" : "public/js/file.js"}
# include js in doctype views
-doctype_js = {"Sales Order" : "public/js/sales_order.js"}
+doctype_js = {"Sales Invoice" : "public/js/sales_invoice.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
diff --git a/sinai_spark/public/js/sales_invoice.js b/sinai_spark/public/js/sales_invoice.js
new file mode 100644
index 0000000..e9a6a14
--- /dev/null
+++ b/sinai_spark/public/js/sales_invoice.js
@@ -0,0 +1,8 @@
+frappe.ui.form.on('Sales Invoice', {
+ refresh: function (frm) {
+ setTimeout(() => {
+ frm.remove_custom_button('Delivery', 'Create');
+ frm.remove_custom_button('Payment Request', 'Create');
+ }, 500);
+ }
+});
\ No newline at end of file
diff --git a/sinai_spark/public/js/sales_order.js b/sinai_spark/public/js/sales_oder.js
similarity index 100%
rename from sinai_spark/public/js/sales_order.js
rename to sinai_spark/public/js/sales_oder.js
diff --git a/sinai_spark/sinai_spark/doctype/attachments/attachments.json b/sinai_spark/sinai_spark/doctype/attachments/attachments.json
index 8aa291c..0970845 100644
--- a/sinai_spark/sinai_spark/doctype/attachments/attachments.json
+++ b/sinai_spark/sinai_spark/doctype/attachments/attachments.json
@@ -1,6 +1,7 @@
{
"actions": [],
"allow_rename": 1,
+ "autoname": ".#####",
"creation": "2025-01-23 10:32:39.868273",
"doctype": "DocType",
"editable_grid": 1,
@@ -19,10 +20,11 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2025-01-23 10:34:47.862568",
+ "modified": "2025-01-25 10:22:30.556864",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Attachments",
+ "naming_rule": "Expression (old style)",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
diff --git a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.js b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.js
index a0aa43d..32d1752 100644
--- a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.js
+++ b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.js
@@ -66,10 +66,129 @@ frappe.ui.form.on("Business Proposal", {
});
}, __("Change Status"));
-
-
-
},
+ status: function(frm) {
+ if (frm.doc.status === "Under Negotiation") {
+ frappe.confirm(
+ 'The status is set to "Under Negotiation". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.business_proposal.business_proposal.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+
+ }
+ );
+ }
+ else if (frm.doc.status === "Pending") {
+ frappe.confirm(
+ 'The status is set to "Pending". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.business_proposal.business_proposal.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+
+ }
+ );
+ }
+ else if (frm.doc.status === "Proposal Sent") {
+ frappe.confirm(
+ 'The status is set to "Proposal Sent". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.business_proposal.business_proposal.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+
+ }
+ );
+ }
+ else if (frm.doc.status === "Completed") {
+ frappe.confirm(
+ 'The status is set to "Completed". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.business_proposal.business_proposal.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+
+ }
+ );
+ }
+ else if (frm.doc.status === "Rejected") {
+ frappe.confirm(
+ 'The status is set to "Rejected". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.business_proposal.business_proposal.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+
+ }
+ );
+ }
+ }
});
//////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -170,7 +289,4 @@ frappe.ui.form.on("Business Proposal Item","business_proposal_item_remove",funct
frm.set_value('total_amount',total)
frm.refresh_field("total_amount")
-});
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
+});
\ No newline at end of file
diff --git a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.json b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.json
index 3356753..2972112 100644
--- a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.json
+++ b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.json
@@ -25,7 +25,6 @@
"reference_details_section",
"column_break_ezqe",
"enquiry",
- "column_break_skqx",
"connections_tab"
],
"fields": [
@@ -141,10 +140,6 @@
"fieldname": "remarks",
"fieldtype": "Small Text",
"label": "Remarks"
- },
- {
- "fieldname": "column_break_skqx",
- "fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
@@ -155,7 +150,7 @@
"link_fieldname": "business_proposal__id"
}
],
- "modified": "2025-01-23 16:01:50.930166",
+ "modified": "2024-10-22 17:02:45.819473",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Business Proposal",
diff --git a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.py b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.py
index b36071c..5e93943 100644
--- a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.py
+++ b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal.py
@@ -211,3 +211,74 @@ def get_change(status, docname):
# # Commit the changes to the database
# frappe.db.commit()
# return True
+
+@frappe.whitelist()
+def send_mail_to_hr(docname):
+ try:
+ # Fetch the document
+ doc = frappe.get_doc("Business Proposal", docname)
+
+ # Fetch HR email(s) from Has Role
+ role = frappe.db.get_value("Sinai Spark Settings", None, "role")
+
+ if not role:
+ return frappe.throw("No HR Manager's email found in the system.")
+
+ # Email details
+ if doc.status == "Under Negotiation":
+ subject = f"Business Proposal {doc.name} is Under Negotiation"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Under Negotiation.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Pending":
+ subject = f"Business Proposal {doc.name} is Pending"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Pending.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Proposal Sent":
+ subject = f"Business Proposal {doc.name} is Proposal Sent"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Proposal Sent.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Completed":
+ subject = f"Business Proposal {doc.name} is Completed"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Completed.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Rejected":
+ subject = f"Business Proposal {doc.name} is Rejected"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Rejected.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+
+ # Send email
+ frappe.sendmail(
+ recipients=role,
+ subject=subject,
+ message=message,
+ )
+ return "success"
+
+ except Exception as e:
+ frappe.log_error(frappe.get_traceback(), "Business Proposal Email Error")
+ return "error"
diff --git a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal_dashboard.py b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal_dashboard.py
index 116a77f..ad07240 100644
--- a/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal_dashboard.py
+++ b/sinai_spark/sinai_spark/doctype/business_proposal/business_proposal_dashboard.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
from frappe import _
-
def get_data():
return {
'heatmap': True,
@@ -20,4 +19,3 @@ def get_data():
"Enquiry": "enquiry"
}
}
-
diff --git a/sinai_spark/sinai_spark/doctype/document_expiry_details/document_expiry_details.json b/sinai_spark/sinai_spark/doctype/document_expiry_details/document_expiry_details.json
index bc351c3..eaced2c 100644
--- a/sinai_spark/sinai_spark/doctype/document_expiry_details/document_expiry_details.json
+++ b/sinai_spark/sinai_spark/doctype/document_expiry_details/document_expiry_details.json
@@ -8,7 +8,8 @@
"field_order": [
"document_expiry_item",
"column_break_aovz",
- "document_expiry_date"
+ "document_expiry_date",
+ "attach"
],
"fields": [
{
@@ -29,12 +30,17 @@
{
"fieldname": "column_break_aovz",
"fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "attach",
+ "fieldtype": "Attach",
+ "label": "Attach"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2024-06-20 08:49:02.844641",
+ "modified": "2025-01-28 14:29:39.708571",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Document Expiry Details",
diff --git a/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving.json b/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving.json
index ae35612..fa54e1f 100644
--- a/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving.json
+++ b/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving.json
@@ -6,7 +6,8 @@
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
- "details_tab",
+ "section_break_gkzo",
+ "column_break_bybw",
"customer",
"remarks",
"column_break_sjbn",
@@ -36,6 +37,14 @@
"connections_tab"
],
"fields": [
+ {
+ "fieldname": "section_break_gkzo",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "column_break_bybw",
+ "fieldtype": "Column Break"
+ },
{
"fieldname": "column_break_sjbn",
"fieldtype": "Column Break"
@@ -202,17 +211,21 @@
"fieldtype": "Table",
"label": "Document Expiry Details",
"options": "Document Expiry Details"
- },
- {
- "fieldname": "details_tab",
- "fieldtype": "Tab Break",
- "label": "Details"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
- "links": [],
- "modified": "2025-01-23 15:24:25.547253",
+ "links": [
+ {
+ "link_doctype": "Sales Order",
+ "link_fieldname": "custom_document_receiving"
+ },
+ {
+ "link_doctype": "Company Formation",
+ "link_fieldname": "document_receiving"
+ }
+ ],
+ "modified": "2024-06-20 08:39:33.948469",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Document Receiving",
diff --git a/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving_dashboard.py b/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving_dashboard.py
index 68e3025..f8bc352 100644
--- a/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving_dashboard.py
+++ b/sinai_spark/sinai_spark/doctype/document_receiving/document_receiving_dashboard.py
@@ -1,6 +1,4 @@
-
from frappe import _
-
def get_data():
return {
"fieldname": "business_proposal__id",
diff --git a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.js b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.js
index 697105b..aea302d 100644
--- a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.js
+++ b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.js
@@ -61,61 +61,64 @@ frappe.ui.form.on("Enquiry", {
// frm.page.clear_secondary_action();
// }
-
} else {
// Remove the custom button if the document is new
frm.page.clear_secondary_action();
}
-
- if (frm.doc.docstatus ==1) {
-
-
-
- if(frm.doc.status != "Converted" || "Meeting On Going" || "Meeting Done" || "Proposal Sending" || "Completed") {
-
- frm.add_custom_button(__('Pending'), function() {
- frm.set_value('status', 'Pending');
- }, __("Change Status"));
-
- frm.add_custom_button(__('To Consultant'), function() {
- frm.set_value('status', 'To Consultant');
- }, __("Change Status"));
-
- frm.add_custom_button(__('Rejected'), function() {
- frm.set_value('status', 'Rejected');
- }, __("Change Status"));
-
- frm.add_custom_button(__('Hold'), function() {
- frm.set_value('status', 'Hold');
- }, __("Change Status"));
-
- frm.add_custom_button(__('Closed'), function() {
- frm.set_value('status', 'Closed');
- }, __("Change Status"));
-
- frm.add_custom_button(__('No Response'), function() {
- frm.set_value('status', 'No Response');
- }, __("Change Status"));
-
- frm.add_custom_button(__('Need Assistance'), function() {
- frm.set_value('status', 'Need Assistance');
- }, __("Change Status"));
-
- frm.add_custom_button(__('Just Data Base'), function() {
- frm.set_value('status', 'Just Data Base');
- }, __("Change Status"));
-
- // frm.add_custom_button(__('Converted'), function() {
- // frm.set_value('status', 'Converted');
- // }, __("Change Status"));
-
- // frm.add_custom_button(__('To Proposal'), function() {
- // frm.set_value('status', 'To Proposal');
- // }, __("Change Status"));
+ if (frm.doc.docstatus == 1) {
+ if (
+ frm.doc.status != "Converted" &&
+ frm.doc.status != "Meeting On Going" &&
+ frm.doc.status != "Meeting Done" &&
+ frm.doc.status != "Proposal Sending" &&
+ frm.doc.status != "Completed"
+ ) {
+ const statuses = [
+ { label: "Pending", value: "Pending" },
+ { label: "To Consultant", value: "To Consultant" },
+ { label: "Rejected", value: "Rejected" },
+ { label: "Hold", value: "Hold" },
+ { label: "Closed", value: "Closed" },
+ { label: "No Response", value: "No Response" },
+ { label: "Need Assistance", value: "Need Assistance" },
+ { label: "Just Data Base", value: "Just Data Base" },
+ ];
+
+ statuses.forEach((status) => {
+ const button = frm.add_custom_button(
+ __(status.label),
+ function () {
+ if (frm.doc.status !== status.value) {
+ frm.set_value("status", status.value);
+ frm.save();
+ // Add a class to indicate the button is permanently styled
+ button.addClass("status-changed");
+ button.css({
+ "background-color": "#ffffff",
+ color: "#8b8b8c",
+ });
+ }
+ },
+ __("Change Status")
+ );
+
+ // Apply permanent styling if the button already matches the status
+ if (frm.doc.status === status.value) {
+ button.addClass("status-changed");
+ button.css({
+ "background-color": "#ffffff",
+ color: "#8b8b8c",
+ });
+ }
+ });
}
- }
+ }
+
+
+
+
if (frm.doc.status === "Converted"){
@@ -262,6 +265,192 @@ frappe.ui.form.on("Enquiry", {
iata_code: function(frm) {
set_reference_no(frm);
},
+ status: function(frm) {
+ if (frm.doc.status === "Pending") {
+ frappe.confirm(
+ 'The status is set to "Pending". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "To Consultant") {
+ frappe.confirm(
+ 'The status is set to "To Consultant". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "Rejected") {
+ frappe.confirm(
+ 'The status is set to "Rejected". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "Hold") {
+ frappe.confirm(
+ 'The status is set to "Hold". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "Closed") {
+ frappe.confirm(
+ 'The status is set to "Closed". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "Need Assistance") {
+ frappe.confirm(
+ 'The status is set to "Need Assistance". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "No Response") {
+ frappe.confirm(
+ 'The status is set to "No Response". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ else if (frm.doc.status === "Just Data Base") {
+ frappe.confirm(
+ 'The status is set to "Just Data Base". Do you want to Send E-mail?',
+ function() {
+ // User confirmed, proceed to send the email
+ frappe.call({
+ method: 'sinai_spark.sinai_spark.doctype.enquiry.enquiry.send_mail_to_hr',
+ args: {
+ docname: frm.doc.name
+ },
+ callback: function(response) {
+ if (response.message === 'success') {
+ frappe.msgprint(__('Email sent to HR successfully.'));
+ } else {
+ frappe.msgprint(__('Failed to send email. Please try again.'));
+ }
+ }
+ });
+ },
+ function() {
+ }
+ );
+ }
+ }
// onload:function(frm){
// if (frm.doc.status === "Proposal Sending") {
diff --git a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.json b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.json
index 1ca0b1b..f3f4189 100644
--- a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.json
+++ b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.json
@@ -32,8 +32,8 @@
"remarks",
"column_break_yfia",
"value",
- "section_break_xmzg",
- "attachments",
+ "attachments_section",
+ "attach",
"connections_tab"
],
"fields": [
@@ -200,25 +200,21 @@
"label": "Consultant Remarks"
},
{
- "fieldname": "section_break_xmzg",
- "fieldtype": "Section Break"
+ "fieldname": "attachments_section",
+ "fieldtype": "Section Break",
+ "label": "Attachments"
},
{
- "fieldname": "attachments",
+ "fieldname": "attach",
"fieldtype": "Table",
- "label": "Attachments",
+ "label": "Attach",
"options": "Attachments"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
- "links": [
- {
- "link_doctype": "Business Proposal",
- "link_fieldname": "enquiry"
- }
- ],
- "modified": "2025-01-23 10:54:53.008964",
+ "links": [],
+ "modified": "2025-01-25 14:46:39.043168",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Enquiry",
diff --git a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.py b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.py
index 6b20edd..25155f6 100644
--- a/sinai_spark/sinai_spark/doctype/enquiry/enquiry.py
+++ b/sinai_spark/sinai_spark/doctype/enquiry/enquiry.py
@@ -53,6 +53,112 @@ def get_next_reference_no(service_code, iata_code):
next_reference_no = f"{next_number:04d}"
return next_reference_no
+@frappe.whitelist()
+def send_mail_to_hr(docname):
+ try:
+ # Fetch the document
+ doc = frappe.get_doc("Business Proposal", docname)
+
+ # Fetch HR email(s) from Has Role
+ role = frappe.db.get_value("Sinai Spark Settings", None, "role")
+
+ if not role:
+ return frappe.throw("No HR Manager's email found in the system.")
+
+ # Email details
+ if doc.status == "Pending":
+ subject = f"Business Proposal {doc.name} is Pending"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Pending.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "To Consultant":
+ subject = f"Business Proposal {doc.name} is To Consultant"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status To Consultant.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Rejected":
+ subject = f"Business Proposal {doc.name} is Rejectedt"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Rejected.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Hold":
+ subject = f"Business Proposal {doc.name} is Hold"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Hold.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Closed":
+ subject = f"Business Proposal {doc.name} is Closed"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Closed.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "No Response":
+ subject = f"Business Proposal {doc.name} is No Response"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status No Response.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Rejected":
+ subject = f"Business Proposal {doc.name} is Rejected"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Rejected.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Need Assistance":
+ subject = f"Business Proposal {doc.name} is Need Assistance"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Need Assistance.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+ elif doc.status == "Just Data Base":
+ subject = f"Business Proposal {doc.name} is Just Data Base"
+ message = f"""
+ Hello Team,
+ The business proposal {doc.name} has been moved to the status Just Data Base.
+ Please review the details and take necessary action.
+ Regards,
+ System Notification
+ """
+
+ # Send email
+ frappe.sendmail(
+ recipients=role,
+ subject=subject,
+ message=message,
+ )
+ return "success"
+
+ except Exception as e:
+ frappe.log_error(frappe.get_traceback(), "Business Proposal Email Error")
+ return "error"
# import frappe
diff --git a/sinai_spark/sinai_spark/doctype/item_details_dr/item_details_dr.json b/sinai_spark/sinai_spark/doctype/item_details_dr/item_details_dr.json
index 3af120a..41ae5a3 100644
--- a/sinai_spark/sinai_spark/doctype/item_details_dr/item_details_dr.json
+++ b/sinai_spark/sinai_spark/doctype/item_details_dr/item_details_dr.json
@@ -11,10 +11,10 @@
"uom",
"qty",
"rate",
- "attach",
"conversion_factor",
"column_break_jwrc",
- "sales_order"
+ "sales_order",
+ "attach"
],
"fields": [
{
@@ -74,14 +74,13 @@
{
"fieldname": "attach",
"fieldtype": "Attach",
- "in_list_view": 1,
"label": "Attach"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2025-01-23 16:09:45.740108",
+ "modified": "2025-01-25 14:47:57.708138",
"modified_by": "Administrator",
"module": "Sinai Spark",
"name": "Item Details DR",
diff --git a/sinai_spark/sinai_spark/doctype/sinai_spark_settings/__init__.py b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.js b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.js
new file mode 100644
index 0000000..6e2862d
--- /dev/null
+++ b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2025, sammish and contributors
+// For license information, please see license.txt
+
+// frappe.ui.form.on("Sinai Spark Settings", {
+// refresh(frm) {
+
+// },
+// });
diff --git a/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.json b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.json
new file mode 100644
index 0000000..1da41fa
--- /dev/null
+++ b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.json
@@ -0,0 +1,41 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2025-01-24 15:56:56.119173",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "role"
+ ],
+ "fields": [
+ {
+ "fieldname": "role",
+ "fieldtype": "Link",
+ "label": "Role",
+ "options": "User"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "issingle": 1,
+ "links": [],
+ "modified": "2025-01-24 15:57:30.641766",
+ "modified_by": "Administrator",
+ "module": "Sinai Spark",
+ "name": "Sinai Spark Settings",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+}
\ No newline at end of file
diff --git a/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.py b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.py
new file mode 100644
index 0000000..6116ec9
--- /dev/null
+++ b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/sinai_spark_settings.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2025, sammish and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class SinaiSparkSettings(Document):
+ pass
diff --git a/sinai_spark/sinai_spark/doctype/sinai_spark_settings/test_sinai_spark_settings.py b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/test_sinai_spark_settings.py
new file mode 100644
index 0000000..9938b5c
--- /dev/null
+++ b/sinai_spark/sinai_spark/doctype/sinai_spark_settings/test_sinai_spark_settings.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2025, sammish and Contributors
+# See license.txt
+
+# import frappe
+from frappe.tests.utils import FrappeTestCase
+
+
+class TestSinaiSparkSettings(FrappeTestCase):
+ pass