Skip to content

Commit

Permalink
feat: allow to send whatsapp template with custom data dict
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryPaulo committed Nov 13, 2024
1 parent 78b3d7d commit 339bb18
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,21 @@ def send_template(self):
parameters = []
template_parameters = []

ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
for field_name in field_names:
value = ref_doc.get_formatted(field_name.strip())
if self.flags.custom_ref_doc:
custom_values = self.flags.custom_ref_doc
for field_name in field_names:
value = custom_values.get(field_name.strip())
parameters.append({"type": "text", "text": value})
template_parameters.append(value)

else:
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
for field_name in field_names:
value = ref_doc.get_formatted(field_name.strip())

parameters.append({"type": "text", "text": value})
template_parameters.append(value)

parameters.append({"type": "text", "text": value})
template_parameters.append(value)

self.template_parameters = json.dumps(template_parameters)

Expand Down

0 comments on commit 339bb18

Please sign in to comment.