mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
feat: Added custom button to make inter company order
This commit is contained in:
@@ -138,6 +138,20 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
erpnext.utils.make_subscription(doc.doctype, doc.name)
|
erpnext.utils.make_subscription(doc.doctype, doc.name)
|
||||||
}, __('Create'))
|
}, __('Create'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc.docstatus == 1 && !doc.inter_company_order_reference) {
|
||||||
|
let me = this;
|
||||||
|
frappe.model.with_doc("Supplier", me.frm.doc.supplier, () => {
|
||||||
|
let supplier = frappe.model.get_doc("Supplier", me.frm.doc.supplier);
|
||||||
|
let internal = supplier.is_internal_supplier;
|
||||||
|
let disabled = supplier.disabled;
|
||||||
|
if (internal == 1 && disabled == 0) {
|
||||||
|
me.frm.add_custom_button("Inter Company Order", function() {
|
||||||
|
me.make_inter_company_order(me.frm);
|
||||||
|
}, __('Create'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(flt(doc.per_billed)==0) {
|
if(flt(doc.per_billed)==0) {
|
||||||
this.frm.add_custom_button(__('Payment Request'),
|
this.frm.add_custom_button(__('Payment Request'),
|
||||||
@@ -296,6 +310,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
make_inter_company_order: function(frm) {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_inter_company_sales_order",
|
||||||
|
frm: frm
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
make_purchase_receipt: function() {
|
make_purchase_receipt: function() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
|
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
|
||||||
|
|||||||
@@ -204,6 +204,20 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
erpnext.utils.make_subscription(doc.doctype, doc.name)
|
erpnext.utils.make_subscription(doc.doctype, doc.name)
|
||||||
}, __('Create'))
|
}, __('Create'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc.docstatus == 1 && !doc.inter_company_order_reference) {
|
||||||
|
let me = this;
|
||||||
|
frappe.model.with_doc("Customer", me.frm.doc.customer, () => {
|
||||||
|
let customer = frappe.model.get_doc("Customer", me.frm.doc.customer);
|
||||||
|
let internal = customer.is_internal_customer;
|
||||||
|
let disabled = customer.disabled;
|
||||||
|
if (internal == 1 && disabled == 0) {
|
||||||
|
me.frm.add_custom_button("Inter Company Order", function() {
|
||||||
|
me.make_inter_company_order();
|
||||||
|
}, __('Create'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// payment request
|
// payment request
|
||||||
if(flt(doc.per_billed)==0) {
|
if(flt(doc.per_billed)==0) {
|
||||||
@@ -500,6 +514,13 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
make_inter_company_order: function() {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.selling.doctype.sales_order.sales_order.make_inter_company_purchase_order",
|
||||||
|
frm: this.frm
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
make_maintenance_visit: function() {
|
make_maintenance_visit: function() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
|
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
|
||||||
|
|||||||
Reference in New Issue
Block a user