mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
Merge pull request #51969 from frappe/mergify/bp/version-15-hotfix/pr-51964
fix: create DN btn should not be shown if it cannot be created (backport #51964)
This commit is contained in:
@@ -118,6 +118,13 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!is_delivered_by_supplier) {
|
if (!is_delivered_by_supplier) {
|
||||||
|
const should_create_delivery_note = doc.items.some(
|
||||||
|
(item) =>
|
||||||
|
item.qty - item.delivered_qty > 0 &&
|
||||||
|
!item.dn_detail &&
|
||||||
|
!item.delivered_by_supplier
|
||||||
|
);
|
||||||
|
if (should_create_delivery_note) {
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
__("Delivery Note"),
|
__("Delivery Note"),
|
||||||
this.frm.cscript["Make Delivery Note"],
|
this.frm.cscript["Make Delivery Note"],
|
||||||
@@ -125,6 +132,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (doc.outstanding_amount > 0) {
|
if (doc.outstanding_amount > 0) {
|
||||||
cur_frm.add_custom_button(
|
cur_frm.add_custom_button(
|
||||||
|
|||||||
@@ -2211,7 +2211,9 @@ def make_delivery_note(source_name, target_doc=None):
|
|||||||
"cost_center": "cost_center",
|
"cost_center": "cost_center",
|
||||||
},
|
},
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.delivered_by_supplier != 1 and not doc.dn_detail,
|
"condition": lambda doc: doc.delivered_by_supplier != 1
|
||||||
|
and not doc.dn_detail
|
||||||
|
and doc.qty - doc.delivered_qty > 0,
|
||||||
},
|
},
|
||||||
"Sales Taxes and Charges": {"doctype": "Sales Taxes and Charges", "reset_value": True},
|
"Sales Taxes and Charges": {"doctype": "Sales Taxes and Charges", "reset_value": True},
|
||||||
"Sales Team": {
|
"Sales Team": {
|
||||||
|
|||||||
Reference in New Issue
Block a user