Skip to content

Commit 71dd9e4

Browse files
authored
Merge pull request #682 from frappe/develop
chore: Merge develop to main
2 parents 7ca0987 + 3c1d8f2 commit 71dd9e4

26 files changed

+1295
-222
lines changed

Diff for: crm/api/__init__.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_user_signature():
4444
if html_signature:
4545
_signature = html_signature.renderContents()
4646
content = ""
47-
if (cstr(_signature) or signature):
47+
if cstr(_signature) or signature:
4848
content = f'<br><p class="signature">{signature}</p>'
4949
return content
5050

@@ -64,14 +64,16 @@ def check_app_permission():
6464
return True
6565

6666
roles = frappe.get_roles()
67-
if any(role in ["System Manager", "Sales User", "Sales Manager", "Sales Master Manager"] for role in roles):
67+
if any(
68+
role in ["System Manager", "Sales User", "Sales Manager", "Sales Master Manager"] for role in roles
69+
):
6870
return True
6971

7072
return False
7173

7274

7375
@frappe.whitelist(allow_guest=True)
74-
def accept_invitation(key: str = None):
76+
def accept_invitation(key: str | None = None):
7577
if not key:
7678
frappe.throw("Invalid or expired key")
7779

@@ -91,6 +93,7 @@ def accept_invitation(key: str = None):
9193

9294
@frappe.whitelist()
9395
def invite_by_email(emails: str, role: str):
96+
frappe.only_for("Sales Manager")
9497
if not emails:
9598
return
9699
email_string = validate_email_address(emails, throw=False)
@@ -120,8 +123,8 @@ def get_file_uploader_defaults(doctype: str):
120123
make_attachments_public = meta.get("make_attachments_public")
121124

122125
return {
123-
'allowed_file_types': frappe.get_system_settings("allowed_file_extensions"),
124-
'max_file_size': get_max_file_size(),
125-
'max_number_of_files': max_number_of_files,
126-
'make_attachments_public': bool(make_attachments_public),
127-
}
126+
"allowed_file_types": frappe.get_system_settings("allowed_file_extensions"),
127+
"max_file_size": get_max_file_size(),
128+
"max_number_of_files": max_number_of_files,
129+
"make_attachments_public": bool(make_attachments_public),
130+
}

Diff for: crm/api/onboarding.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import frappe
2+
3+
4+
@frappe.whitelist()
5+
def get_first_lead():
6+
lead = frappe.get_all(
7+
"CRM Lead",
8+
filters={"converted": 0},
9+
fields=["name"],
10+
order_by="creation",
11+
limit=1,
12+
)
13+
return lead[0].name if lead else None
14+
15+
16+
@frappe.whitelist()
17+
def get_first_deal():
18+
deal = frappe.get_all(
19+
"CRM Deal",
20+
fields=["name"],
21+
order_by="creation",
22+
limit=1,
23+
)
24+
return deal[0].name if deal else None

0 commit comments

Comments
 (0)