[Fix] Customer and Address blank if does not exist in Delivery Stops (#11895)

This commit is contained in:
KanchanChauhan 2017-12-11 12:38:30 +05:30 committed by Nabin Hait
parent 7f8df06663
commit 236ac5eb38
2 changed files with 12 additions and 1 deletions

View File

@ -104,9 +104,19 @@ frappe.ui.form.on('Delivery Stop', {
if (r.message["shipping_address"]) {
frappe.model.set_value(cdt, cdn, "address", r.message["shipping_address"].parent);
}
else {
frappe.model.set_value(cdt, cdn, "address", '');
}
if (r.message["contact_person"]) {
frappe.model.set_value(cdt, cdn, "contact", r.message["contact_person"].parent);
}
else {
frappe.model.set_value(cdt, cdn, "contact", '');
}
}
else {
frappe.model.set_value(cdt, cdn, "address", '');
frappe.model.set_value(cdt, cdn, "contact", '');
}
}
});

View File

@ -166,11 +166,12 @@ def notify_customers(docname, date, driver, vehicle, sender_email, delivery_noti
delivery_notes = (delivery_stop_info.delivery_notes).split(",")
attachments = []
for delivery_note in delivery_notes:
default_print_format = frappe.get_value('Delivery Note', delivery_note, 'default_print_format')
attachments.append(
frappe.attach_print('Delivery Note',
delivery_note,
file_name="Delivery Note",
print_format='Delivery Note'))
print_format=default_print_format or "Standard"))
if not delivery_stop_info.notified_by_email and contact_info.email_id:
driver_info = frappe.db.get_value("Driver", driver, ["full_name", "cell_number"], as_dict=1)