Make Debit / Credit Note button in Purchase / Sales Invoice

This commit is contained in:
Nabin Hait 2015-07-29 13:23:37 +05:30
parent 1e046aa49a
commit 9eb9ccd785
3 changed files with 7 additions and 6 deletions

View File

@ -28,7 +28,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
this.frm.add_custom_button(__('Make Payment Entry'), this.make_bank_entry);
}
cur_frm.add_custom_button(__('Make Purchase Return'), this.make_purchase_return);
cur_frm.add_custom_button(__('Make Debit Note'), this.make_debit_note);
}
if(doc.docstatus===0) {
@ -103,9 +103,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
})
},
make_purchase_return: function() {
make_debit_note: function() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_purchase_return",
method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_debit_note",
frm: cur_frm
})
},

View File

@ -411,6 +411,6 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
'txt': "%%%s%%" % frappe.db.escape(txt), 'mcond':get_match_cond(doctype)})
@frappe.whitelist()
def make_purchase_return(source_name, target_doc=None):
def make_debit_note(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
return make_return_doc("Purchase Invoice", source_name, target_doc)
return make_return_doc("Purchase Invoice", source_name, target_doc)

View File

@ -65,7 +65,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
cur_frm.add_custom_button(__('Make Payment Entry'), cur_frm.cscript.make_bank_entry);
}
cur_frm.add_custom_button(__('Make Sales Return'), this.make_sales_return);
cur_frm.add_custom_button(doc.update_stock ? __('Make Sales Return') : __('Make Credit Note'),
this.make_sales_return);
}
// Show buttons only when pos view is active