mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-12 17:23:38 +00:00
fix: create DN btn should not be shown if it cannot be created
(cherry picked from commit 70ec977cb2)
This commit is contained in:
@@ -116,11 +116,20 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
|||||||
|
|
||||||
if (cint(doc.update_stock) != 1) {
|
if (cint(doc.update_stock) != 1) {
|
||||||
if (!is_delivered_by_supplier) {
|
if (!is_delivered_by_supplier) {
|
||||||
this.frm.add_custom_button(
|
const should_create_delivery_note = doc.items.some(
|
||||||
__("Delivery Note"),
|
(item) =>
|
||||||
this.frm.cscript["Make Delivery Note"],
|
item.qty - item.delivered_qty > 0 &&
|
||||||
__("Create")
|
!item.scio_detail &&
|
||||||
|
!item.dn_detail &&
|
||||||
|
!item.delivered_by_supplier
|
||||||
);
|
);
|
||||||
|
if (should_create_delivery_note) {
|
||||||
|
this.frm.add_custom_button(
|
||||||
|
__("Delivery Note"),
|
||||||
|
this.frm.cscript["Make Delivery Note"],
|
||||||
|
__("Create")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2424,7 +2424,8 @@ def make_delivery_note(source_name, target_doc=None):
|
|||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.delivered_by_supplier != 1
|
"condition": lambda doc: doc.delivered_by_supplier != 1
|
||||||
and not doc.scio_detail
|
and not doc.scio_detail
|
||||||
and not doc.dn_detail,
|
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