mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-19 03:17:55 +00:00
Merge branch 'develop' into dev-work-order-bugs
This commit is contained in:
@@ -173,7 +173,7 @@ class BOM(WebsiteGenerator):
|
||||
#Customer Provided parts will have zero rate
|
||||
if not frappe.db.get_value('Item', arg["item_code"], 'is_customer_provided_item'):
|
||||
if arg.get('bom_no') and self.set_rate_of_sub_assembly_item_based_on_bom:
|
||||
rate = self.get_bom_unitcost(arg['bom_no']) * (arg.get("conversion_factor") or 1)
|
||||
rate = flt(self.get_bom_unitcost(arg['bom_no'])) * (arg.get("conversion_factor") or 1)
|
||||
else:
|
||||
if self.rm_cost_as_per == 'Valuation Rate':
|
||||
rate = self.get_valuation_rate(arg) * (arg.get("conversion_factor") or 1)
|
||||
|
||||
@@ -195,6 +195,7 @@ class ProductionPlan(Document):
|
||||
for data in self.po_items:
|
||||
if data.name == production_plan_item:
|
||||
data.produced_qty = produced_qty
|
||||
data.pending_qty = data.planned_qty - data.produced_qty
|
||||
data.db_update()
|
||||
|
||||
self.calculate_total_produced_qty()
|
||||
|
||||
@@ -91,6 +91,16 @@ frappe.ui.form.on("Work Order", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("operation", "required_items", function() {
|
||||
return {
|
||||
query: "erpnext.manufacturing.doctype.work_order.work_order.get_bom_operations",
|
||||
filters: {
|
||||
'parent': frm.doc.bom_no,
|
||||
'parenttype': 'BOM'
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// formatter for work order operation
|
||||
frm.set_indicator_formatter('operation',
|
||||
function(doc) { return (frm.doc.qty==doc.completed_qty) ? "green" : "orange"; });
|
||||
@@ -549,11 +559,14 @@ erpnext.work_order = {
|
||||
|
||||
get_max_transferable_qty: (frm, purpose) => {
|
||||
let max = 0;
|
||||
if (frm.doc.skip_transfer) return max;
|
||||
if (purpose === 'Manufacture') {
|
||||
max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty);
|
||||
if (frm.doc.skip_transfer) {
|
||||
max = flt(frm.doc.qty) - flt(frm.doc.produced_qty);
|
||||
} else {
|
||||
max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing);
|
||||
if (purpose === 'Manufacture') {
|
||||
max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty);
|
||||
} else {
|
||||
max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing);
|
||||
}
|
||||
}
|
||||
return flt(max, precision('qty'));
|
||||
},
|
||||
|
||||
@@ -543,6 +543,13 @@ class WorkOrder(Document):
|
||||
bom.set_bom_material_details()
|
||||
return bom
|
||||
|
||||
def get_bom_operations(doctype, txt, searchfield, start, page_len, filters):
|
||||
if txt:
|
||||
filters['operation'] = ('like', '%%%s%%' % txt)
|
||||
|
||||
return frappe.get_all('BOM Operation',
|
||||
filters = filters, fields = ['operation'], as_list=1)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_details(item, project = None):
|
||||
res = frappe.db.sql("""
|
||||
|
||||
Reference in New Issue
Block a user