[BUG] Fixes make Production Order from Sales Order
This commit is contained in:
parent
5fa2adcca9
commit
5afc194742
@ -193,7 +193,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(!r.message.every(function(d) { return !!d.pending_qty })) {
|
else if(!r.message) {
|
||||||
frappe.msgprint({
|
frappe.msgprint({
|
||||||
title: __('Production Order not created'),
|
title: __('Production Order not created'),
|
||||||
message: __('Production Order already created for all items with BOM'),
|
message: __('Production Order already created for all items with BOM'),
|
||||||
|
|||||||
@ -336,14 +336,15 @@ class SalesOrder(SellingController):
|
|||||||
bom = get_default_bom_item(i.item_code)
|
bom = get_default_bom_item(i.item_code)
|
||||||
if bom:
|
if bom:
|
||||||
stock_qty = i.qty if i.doctype == 'Packed Item' else i.stock_qty
|
stock_qty = i.qty if i.doctype == 'Packed Item' else i.stock_qty
|
||||||
|
pending_qty= stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
|
||||||
|
where production_item=%s and sales_order=%s and docstatus<2''', (i.item_code, self.name))[0][0])
|
||||||
|
if pending_qty:
|
||||||
items.append(dict(
|
items.append(dict(
|
||||||
item_code= i.item_code,
|
item_code= i.item_code,
|
||||||
bom = bom,
|
bom = bom,
|
||||||
warehouse = i.warehouse,
|
warehouse = i.warehouse,
|
||||||
pending_qty= stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
|
pending_qty = pending_qty
|
||||||
where production_item=%s and sales_order=%s''', (i.item_code, self.name))[0][0])
|
|
||||||
))
|
))
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def on_recurring(self, reference_doc, subscription_doc):
|
def on_recurring(self, reference_doc, subscription_doc):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user