fix(ux): SCR consumed-qty read-only property
This commit is contained in:
parent
e927f6cab1
commit
adf2474d9d
@ -76,26 +76,14 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
}
|
||||
});
|
||||
|
||||
let batch_no_field = frm.get_docfield("items", "batch_no");
|
||||
let batch_no_field = frm.get_docfield('items', 'batch_no');
|
||||
if (batch_no_field) {
|
||||
batch_no_field.get_route_options_for_new_doc = function(row) {
|
||||
return {
|
||||
"item": row.doc.item_code
|
||||
'item': row.doc.item_code
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => {
|
||||
if (val == 'Material Transferred for Subcontract') {
|
||||
frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
|
||||
grid_row.docfields.forEach((df) => {
|
||||
if (df.fieldname == 'consumed_qty') {
|
||||
df.read_only = 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
refresh: (frm) => {
|
||||
@ -157,6 +145,8 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
}
|
||||
});
|
||||
}, __('Get Items From'));
|
||||
|
||||
frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty', 'read_only', frm.doc.__onload && frm.doc.__onload.backflush_based_on === 'BOM');
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -28,6 +28,14 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
},
|
||||
]
|
||||
|
||||
def onload(self):
|
||||
self.set_onload(
|
||||
"backflush_based_on",
|
||||
frappe.db.get_single_value(
|
||||
"Buying Settings", "backflush_raw_materials_of_subcontract_based_on"
|
||||
),
|
||||
)
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.is_return):
|
||||
self.status_updater.extend(
|
||||
|
Loading…
x
Reference in New Issue
Block a user