diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 14f5192951..bacc8ec92a 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -20,7 +20,10 @@ class SellingController(StockController): check_active_sales_items(self) def get_sender(self, comm): - return frappe.db.get_value('Sales Email Settings', None, 'email_id') + if frappe.db.get_value('Sales Email Settings', None, 'extract_emails'): + return frappe.db.get_value('Sales Email Settings', None, 'email_id') + else: + return frappe.session.user def set_missing_values(self, for_validate=False): super(SellingController, self).set_missing_values(for_validate)