fix: warehouse unset when cannot find item warehouse

* cannot set delivery date when all items gets deleted and new are added
This commit is contained in:
Saqib Ansari
2020-04-15 22:08:12 +05:30
parent 34640777cd
commit f53299e98a
2 changed files with 55 additions and 38 deletions

View File

@@ -436,6 +436,44 @@ erpnext.utils.update_child_items = function(opts) {
const cannot_add_row = (typeof opts.cannot_add_row === 'undefined') ? true : opts.cannot_add_row;
const child_docname = (typeof opts.cannot_add_row === 'undefined') ? "items" : opts.child_docname;
this.data = [];
const fields = [{
fieldtype:'Data',
fieldname:"docname",
read_only: 1,
hidden: 1,
}, {
fieldtype:'Link',
fieldname:"item_code",
options: 'Item',
in_list_view: 1,
read_only: 0,
disabled: 0,
label: __('Item Code')
}, {
fieldtype:'Float',
fieldname:"qty",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Qty')
}, {
fieldtype:'Currency',
fieldname:"rate",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Rate')
}];
if (frm.doc.doctype == 'Sales Order' || frm.doc.doctype == 'Purchase Order' ) {
fields.splice(2, 0, {
fieldtype: 'Date',
fieldname: frm.doc.doctype == 'Sales Order' ? "delivery_date" : "schedule_date",
in_list_view: 1,
label: frm.doc.doctype == 'Sales Order' ? __("Delivery Date") : __("Reqd by date")
})
}
const dialog = new frappe.ui.Dialog({
title: __("Update Items"),
fields: [
@@ -450,34 +488,7 @@ erpnext.utils.update_child_items = function(opts) {
get_data: () => {
return this.data;
},
fields: [{
fieldtype:'Data',
fieldname:"docname",
read_only: 1,
hidden: 1,
}, {
fieldtype:'Link',
fieldname:"item_code",
options: 'Item',
in_list_view: 1,
read_only: 0,
disabled: 0,
label: __('Item Code')
}, {
fieldtype:'Float',
fieldname:"qty",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Qty')
}, {
fieldtype:'Currency',
fieldname:"rate",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Rate')
}]
fields: fields
},
],
primary_action: function() {
@@ -506,6 +517,8 @@ erpnext.utils.update_child_items = function(opts) {
"docname": d.name,
"name": d.name,
"item_code": d.item_code,
"delivery_date": d.delivery_date,
"schedule_date": d.schedule_date,
"qty": d.qty,
"rate": d.rate,
});