Merge pull request #49348 from frappe/mergify/bp/version-15-hotfix/pr-49258

feat: optional fixed outgoing email for RfQ (backport #49258)
This commit is contained in:
Mihir Kandoi
2025-08-27 22:46:16 +05:30
committed by GitHub
3 changed files with 23 additions and 3 deletions

View File

@@ -39,7 +39,9 @@
"section_break_xcug",
"auto_create_subcontracting_order",
"column_break_izrr",
"auto_create_purchase_receipt"
"auto_create_purchase_receipt",
"request_for_quotation_tab",
"fixed_email"
],
"fields": [
{
@@ -255,6 +257,19 @@
"fieldname": "set_valuation_rate_for_rejected_materials",
"fieldtype": "Check",
"label": "Set Valuation Rate for Rejected Materials"
},
{
"fieldname": "request_for_quotation_tab",
"fieldtype": "Tab Break",
"label": "Request for Quotation"
},
{
"description": "If set, the system does not use the user's Email or the standard outgoing Email account for sending request for quotations.",
"fieldname": "fixed_email",
"fieldtype": "Link",
"label": "Fixed Outgoing Email Account",
"link_filters": "[[\"Email Account\",\"enable_outgoing\",\"=\",1]]",
"options": "Email Account"
}
],
"grid_page_length": 50,
@@ -263,7 +278,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-05-16 15:56:38.321369",
"modified": "2025-08-20 22:13:38.506889",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",

View File

@@ -30,6 +30,7 @@ class BuyingSettings(Document):
blanket_order_allowance: DF.Float
buying_price_list: DF.Link | None
disable_last_purchase_rate: DF.Check
fixed_email: DF.Link | None
maintain_same_rate: DF.Check
maintain_same_rate_action: DF.Literal["Stop", "Warn"]
over_transfer_allowance: DF.Float

View File

@@ -289,7 +289,11 @@ class RequestforQuotation(BuyingController):
email_template = frappe.get_doc("Email Template", self.email_template)
message = frappe.render_template(email_template.response_, doc_args)
subject = frappe.render_template(email_template.subject, doc_args)
sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
fixed_procurement_email = frappe.db.get_single_value("Buying Settings", "fixed_email")
if fixed_procurement_email:
sender = frappe.db.get_value("Email Account", fixed_procurement_email, "email_id")
else:
sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
if preview:
return {"message": message, "subject": subject}