make inter company invoice button on Invoices
This commit is contained in:
parent
462e18ad2e
commit
30b2480cfe
@ -101,6 +101,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.set_default_print_format();
|
this.set_default_print_format();
|
||||||
|
var me = this;
|
||||||
|
if (doc.docstatus == 1 && !doc.inter_company_invoice_reference) {
|
||||||
|
frappe.model.with_doc("Customer", me.frm.doc.customer, function() {
|
||||||
|
var customer = frappe.model.get_doc("Customer", me.frm.doc.customer);
|
||||||
|
var internal = customer.is_internal_customer;
|
||||||
|
if (internal == 1) {
|
||||||
|
me.frm.add_custom_button("Inter Company Invoice", function() {
|
||||||
|
me.validate_inter_company_invoice(me.frm);
|
||||||
|
}, __("Make"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
on_submit: function(doc, dt, dn) {
|
on_submit: function(doc, dt, dn) {
|
||||||
@ -213,11 +225,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
tc_name: function() {
|
tc_name: function() {
|
||||||
this.get_terms();
|
this.get_terms();
|
||||||
},
|
},
|
||||||
|
|
||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.updating_party_details) return;
|
if(this.frm.updating_party_details) return;
|
||||||
|
|
||||||
erpnext.utils.get_party_details(this.frm,
|
erpnext.utils.get_party_details(this.frm,
|
||||||
"erpnext.accounts.party.get_party_details", {
|
"erpnext.accounts.party.get_party_details", {
|
||||||
posting_date: this.frm.doc.posting_date,
|
posting_date: this.frm.doc.posting_date,
|
||||||
@ -230,6 +240,26 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
validate_inter_company_invoice: function(frm) {
|
||||||
|
var me = this;
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.validate_inter_company_invoice",
|
||||||
|
args: {"doc": frm.doc},
|
||||||
|
callback: function(r) {
|
||||||
|
if (r && r.message) {
|
||||||
|
me.make_inter_company_invoice(frm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
make_inter_company_invoice: function(frm) {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_inter_company_purchase_invoice",
|
||||||
|
frm: frm
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
debit_to: function() {
|
debit_to: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.debit_to) {
|
if(this.frm.doc.debit_to) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user