feat: optional fixed outgoing email for RfQ (#49258)

* feat: optional fixed outgoing email for RfQ

* fix: linters

* fix: select only outgoing account

* fix: linters

(cherry picked from commit 2bf0ba9802)
This commit is contained in:
0xD0M1M0
2025-08-27 18:31:54 +02:00
committed by Mergify
parent 7926cfd8c4
commit c875ff972f
3 changed files with 23 additions and 3 deletions

View File

@@ -39,7 +39,9 @@
"section_break_xcug", "section_break_xcug",
"auto_create_subcontracting_order", "auto_create_subcontracting_order",
"column_break_izrr", "column_break_izrr",
"auto_create_purchase_receipt" "auto_create_purchase_receipt",
"request_for_quotation_tab",
"fixed_email"
], ],
"fields": [ "fields": [
{ {
@@ -255,6 +257,19 @@
"fieldname": "set_valuation_rate_for_rejected_materials", "fieldname": "set_valuation_rate_for_rejected_materials",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Set Valuation Rate for Rejected Materials" "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, "grid_page_length": 50,
@@ -263,7 +278,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2025-05-16 15:56:38.321369", "modified": "2025-08-20 22:13:38.506889",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Buying Settings", "name": "Buying Settings",

View File

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

View File

@@ -289,6 +289,10 @@ class RequestforQuotation(BuyingController):
email_template = frappe.get_doc("Email Template", self.email_template) email_template = frappe.get_doc("Email Template", self.email_template)
message = frappe.render_template(email_template.response_, doc_args) message = frappe.render_template(email_template.response_, doc_args)
subject = frappe.render_template(email_template.subject, doc_args) subject = frappe.render_template(email_template.subject, doc_args)
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 sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
if preview: if preview: