feat: add custom buttons for invoice and email

This commit is contained in:
Shivam Mishra 2020-07-31 14:54:06 +05:30
parent 8e0314e7f6
commit 3a67a78ece
2 changed files with 16 additions and 1 deletions

View File

@ -8,6 +8,22 @@ frappe.ui.form.on('Membership', {
})
},
refresh: function(frm) {
!frm.doc.invoice && frm.add_custom_button("Generate Invoice", () => {
frm.call("generate_invoice", {
save: true
}).then(() => {
frm.reload_doc();
});
});
frm.add_custom_button("Send Acknowledgement", () => {
frm.call("send_acknowlement").then(() => {
frm.reload_doc();
});
});
},
onload: function(frm) {
frm.add_fetch('membership_type', 'amount', 'amount');
}

View File

@ -67,7 +67,6 @@ class Membership(Document):
member = frappe.get_doc("Member", self.member)
plan = frappe.get_doc("Membership Type", self.membership_type)
settings = frappe.get_doc("Membership Settings")
attachments = []
if not member.customer:
frappe.throw(_("No customer linked to member {}", [member.name]))