mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
Add in delivery note
This commit is contained in:
@@ -58,10 +58,11 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
|
|
||||||
this.dialog.set_primary_action(__('Insert'), function() {
|
this.dialog.set_primary_action(__('Insert'), function() {
|
||||||
me.values = me.dialog.get_values();
|
me.values = me.dialog.get_values();
|
||||||
if(!me.validate()) return;
|
if(me.validate()) {
|
||||||
me.set_items();
|
me.set_items();
|
||||||
refresh_field("items");
|
refresh_field("items");
|
||||||
me.dialog.hide();
|
me.dialog.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.dialog.show();
|
this.dialog.show();
|
||||||
@@ -120,8 +121,10 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
item[attribute] = values[attribute];
|
item[attribute] = values[attribute];
|
||||||
if(this.warehouse_details.type === 'Source Warehouse') {
|
if(this.warehouse_details.type === 'Source Warehouse') {
|
||||||
item.s_warehouse = values.warehouse || warehouse;
|
item.s_warehouse = values.warehouse || warehouse;
|
||||||
} else {
|
} else if(this.warehouse_details.type === 'Target Warehouse') {
|
||||||
item.t_warehouse = values.warehouse || warehouse;
|
item.t_warehouse = values.warehouse || warehouse;
|
||||||
|
} else {
|
||||||
|
item.warehouse = values.warehouse || warehouse;
|
||||||
}
|
}
|
||||||
item.qty = values[qty_field];
|
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);
|
frm.update_in_all_rows('items', 'cost_center', d.cost_center);
|
||||||
},
|
},
|
||||||
item_code: function(frm, dt, dn) {
|
item_code: function(frm, dt, dn) {
|
||||||
refresh_field("items");
|
var d = locals[dt][dn];
|
||||||
erpnext.stock.select_batch_and_serial_no(frm, d);
|
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()
|
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):
|
def update_billed_amount_based_on_so(so_detail, update_modified=True):
|
||||||
# Billed against Sales Order directly
|
# Billed against Sales Order directly
|
||||||
billed_against_so = frappe.db.sql("""select sum(amount) from `tabSales Invoice Item`
|
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) {
|
$.each(r.message, function(k, v) {
|
||||||
d[k] = v;
|
d[k] = v;
|
||||||
});
|
});
|
||||||
refresh_field("items");
|
|
||||||
erpnext.stock.select_batch_and_serial_no(frm, d);
|
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;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user