Skip to content

Commit

Permalink
Merge pull request #22229 from frappe/version-13-hotfix
Browse files Browse the repository at this point in the history
chore: release v13
  • Loading branch information
ankush committed Aug 29, 2023
2 parents 46ab9df + 2dc5b8c commit b7646a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
14 changes: 5 additions & 9 deletions frappe/automation/doctype/auto_repeat/auto_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,15 +525,11 @@ def get_auto_repeat_doctypes(doctype, txt, searchfield, start, page_len, filters


@frappe.whitelist()
def update_reference(docname, reference):
result = ""
try:
frappe.db.set_value("Auto Repeat", docname, "reference_document", reference)
result = "success"
except Exception as e:
result = "error"
raise e
return result
def update_reference(docname: str, reference: str):
doc = frappe.get_doc("Auto Repeat", str(docname))
doc.check_permission("write")
doc.db_set("reference_document", str(reference))
return "success" # backward compatbility


@frappe.whitelist()
Expand Down
6 changes: 2 additions & 4 deletions frappe/email/email_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def replace_filename_with_cid(message):

filecontent = get_filecontent_from_path(img_path)
if not filecontent:
message = re.sub("""embed=['"]{0}['"]""".format(img_path), "", message)
message = re.sub(f"""embed=['"]{re.escape(img_path)}['"]""", "", message)
continue

content_id = random_string(10)
Expand All @@ -529,9 +529,7 @@ def replace_filename_with_cid(message):
{"filename": filename, "filecontent": filecontent, "content_id": content_id}
)

message = re.sub(
"""embed=['"]{0}['"]""".format(img_path), 'src="cid:{0}"'.format(content_id), message
)
message = re.sub(f"""embed=['"]{re.escape(img_path)}['"]""", f'src="cid:{content_id}"', message)

return (message, inline_images)

Expand Down
15 changes: 8 additions & 7 deletions frappe/workflow/doctype/workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ def get_fieldnames_for(doctype):
def get_workflow_state_count(doctype, workflow_state_field, states):
frappe.has_permission(doctype=doctype, ptype="read", throw=True)
states = frappe.parse_json(states)
result = frappe.get_all(
doctype,
fields=[workflow_state_field, "count(*) as count", "docstatus"],
filters={workflow_state_field: ["not in", states]},
group_by=workflow_state_field,
)
return [r for r in result if r[workflow_state_field]]
if workflow_state_field in frappe.get_meta(doctype).get_valid_columns():
result = frappe.get_all(
doctype,
fields=[workflow_state_field, "count(*) as count"],
filters={workflow_state_field: ["not in", states]},
group_by=workflow_state_field,
)
return [r for r in result if r[workflow_state_field]]

0 comments on commit b7646a5

Please sign in to comment.