fix: Restore "allow delivery" condition checks (#18246)

* fix: Remove `allow_delivery` flag

- User was not able to create delivery note
because allow_delivery flag was false and
it never used to get updated

* fix: Restore allow_delivery condition checks
This commit is contained in:
Suraj Shetty 2019-07-11 10:43:40 +05:30 committed by Nabin Hait
parent c6c6b05522
commit bc2ff785f1

View File

@ -107,7 +107,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
refresh: function(doc, dt, dn) { refresh: function(doc, dt, dn) {
var me = this; var me = this;
this._super(); this._super();
var allow_delivery = false; let allow_delivery = false;
if(doc.docstatus==1) { if(doc.docstatus==1) {
if(this.frm.has_perm("submit")) { if(this.frm.has_perm("submit")) {
@ -132,6 +132,8 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
if(doc.status !== 'Closed') { if(doc.status !== 'Closed') {
if(doc.status !== 'On Hold') { if(doc.status !== 'On Hold') {
allow_delivery = this.frm.doc.items.some(item => item.delivered_by_supplier === 0 && item.qty > flt(item.delivered_qty))
if (this.frm.has_perm("submit")) { if (this.frm.has_perm("submit")) {
if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) { if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) {
// hold // hold