fix: child table naming
diff --git a/erpnext/crm/doctype/email_campaign/email_campaign.py b/erpnext/crm/doctype/email_campaign/email_campaign.py
index 005c2b8..25d54af 100644
--- a/erpnext/crm/doctype/email_campaign/email_campaign.py
+++ b/erpnext/crm/doctype/email_campaign/email_campaign.py
@@ -26,7 +26,7 @@
#set the end date as start date + max(send after days) in campaign schedule
send_after_days = []
- for entry in campaign.get("campaign_schedule"):
+ for entry in campaign.get("campaign_schedules"):
send_after_days.append(entry.send_after_days)
end_date = add_days(getdate(self.start_date), max(send_after_days))
@@ -56,8 +56,8 @@
email_campaigns = frappe.get_all("Email Campaign", filters = { 'status': ('not in', ['Unsubscribed', 'Completed', 'Scheduled']) })
for camp in email_campaigns:
email_campaign = frappe.get_doc("Email Campaign", camp.name)
- campaign = frappe.get_doc("Campaign", email_campaign.campaign_name)
- for entry in campaign.get("campaign_schedule"):
+ campaign = frappe.get_cached_doc("Campaign", email_campaign.campaign_name)
+ for entry in campaign.get("campaign_schedules"):
scheduled_date = add_days(email_campaign.get('start_date'), entry.get('send_after_days'))
if scheduled_date == getdate(today()):
send_mail(entry, email_campaign)
@@ -82,7 +82,6 @@
email_template = email_template.name
)
-@frappe.whitelist(allow_guest=True)
#called from hooks on doc_event Email Unsubscribe
def unsubscribe_recipient(unsubscribe, method):
if unsubscribe.reference_doctype == 'Email Campaign':
diff --git a/erpnext/selling/doctype/campaign/campaign.json b/erpnext/selling/doctype/campaign/campaign.json
index 371a9d5..ee2714f 100644
--- a/erpnext/selling/doctype/campaign/campaign.json
+++ b/erpnext/selling/doctype/campaign/campaign.json
@@ -19,9 +19,8 @@
"currency",
"column_break2",
"budget",
- "schedule_section",
- "campaign_schedule_section",
- "campaign_schedule",
+ "campaign_schedules_section",
+ "campaign_schedules",
"description_section",
"description"
],
@@ -104,24 +103,20 @@
"label": "BUDGET"
},
{
- "fieldname": "campaign_schedule_section",
- "fieldtype": "Section Break",
- "label": "Campaign Schedule"
- },
- {
- "fieldname": "campaign_schedule",
+ "fieldname": "campaign_schedules",
"fieldtype": "Table",
- "label": "Campaign Schedule",
+ "label": "Campaign Schedules",
"options": "Campaign Email Schedule"
},
{
- "fieldname": "schedule_section",
- "fieldtype": "Section Break"
+ "fieldname": "campaign_schedules_section",
+ "fieldtype": "Section Break",
+ "label": "Campaign Schedules"
}
],
"icon": "fa fa-bullhorn",
"idx": 1,
- "modified": "2019-07-12 11:52:47.196736",
+ "modified": "2019-07-15 17:45:06.168107",
"modified_by": "Administrator",
"module": "Selling",
"name": "Campaign",