Add in delivery note
This commit is contained in:
parent
70eca9462b
commit
759f669214
@ -58,10 +58,11 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
|
||||
this.dialog.set_primary_action(__('Insert'), function() {
|
||||
me.values = me.dialog.get_values();
|
||||
if(!me.validate()) return;
|
||||
me.set_items();
|
||||
refresh_field("items");
|
||||
me.dialog.hide();
|
||||
if(me.validate()) {
|
||||
me.set_items();
|
||||
refresh_field("items");
|
||||
me.dialog.hide();
|
||||
}
|
||||
});
|
||||
|
||||
this.dialog.show();
|
||||
@ -120,8 +121,10 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
item[attribute] = values[attribute];
|
||||
if(this.warehouse_details.type === 'Source Warehouse') {
|
||||
item.s_warehouse = values.warehouse || warehouse;
|
||||
} else {
|
||||
} else if(this.warehouse_details.type === 'Target Warehouse') {
|
||||
item.t_warehouse = values.warehouse || warehouse;
|
||||
} else {
|
||||
item.warehouse = values.warehouse || warehouse;
|
||||
}
|
||||
item.qty = values[qty_field];
|
||||
},
|
||||
|
@ -85,8 +85,41 @@ frappe.ui.form.on("Delivery Note Item", {
|
||||
frm.update_in_all_rows('items', 'cost_center', d.cost_center);
|
||||
},
|
||||
item_code: function(frm, dt, dn) {
|
||||
refresh_field("items");
|
||||
erpnext.stock.select_batch_and_serial_no(frm, d);
|
||||
var d = locals[dt][dn];
|
||||
if(d.item_code) {
|
||||
var args = {
|
||||
'item_code': d.item_code,
|
||||
};
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "get_batched_serialized_details",
|
||||
args: args,
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
$.each(r.message, function(k, v) {
|
||||
d[k] = v;
|
||||
});
|
||||
let opts = {
|
||||
frm: frm,
|
||||
item: d,
|
||||
warehouse_details: {
|
||||
type: "From Warehouse",
|
||||
name: d.warehouse
|
||||
},
|
||||
}
|
||||
if(d && d.has_batch_no && !d.batch_no) {
|
||||
opts.has_batch = 1;
|
||||
} else if(d && d.has_serial_no && !d.serial_no) {
|
||||
opts.has_batch = 0;
|
||||
}
|
||||
if(opts.hasOwnProperty("has_batch")) {
|
||||
let serial_no_batch_selector = new erpnext.SerialNoBatchSelector(opts);
|
||||
}
|
||||
refresh_field("items");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -301,6 +301,24 @@ class DeliveryNote(SellingController):
|
||||
|
||||
self.load_from_db()
|
||||
|
||||
def get_batched_serialized_details(self, item_code):
|
||||
item = frappe.db.sql("""
|
||||
select
|
||||
has_serial_no,
|
||||
has_batch_no
|
||||
from
|
||||
`tabItem`
|
||||
where
|
||||
name = %s""",
|
||||
(item_code), as_dict = 1)
|
||||
|
||||
item = item[0]
|
||||
|
||||
return frappe._dict({
|
||||
'has_serial_no' : item.has_serial_no,
|
||||
'has_batch_no' : item.has_batch_no
|
||||
})
|
||||
|
||||
def update_billed_amount_based_on_so(so_detail, update_modified=True):
|
||||
# Billed against Sales Order directly
|
||||
billed_against_so = frappe.db.sql("""select sum(amount) from `tabSales Invoice Item`
|
||||
|
@ -175,8 +175,8 @@ frappe.ui.form.on('Stock Entry Detail', {
|
||||
$.each(r.message, function(k, v) {
|
||||
d[k] = v;
|
||||
});
|
||||
refresh_field("items");
|
||||
erpnext.stock.select_batch_and_serial_no(frm, d);
|
||||
refresh_field("items");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -578,6 +578,7 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => {
|
||||
opts.has_batch = 0;
|
||||
}
|
||||
|
||||
let serial_no_batch_selector = new erpnext.SerialNoBatchSelector(opts);
|
||||
|
||||
if(opts.hasOwnProperty("has_batch")) {
|
||||
let serial_no_batch_selector = new erpnext.SerialNoBatchSelector(opts);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user