Question on get items from BOM

Hi

When I do get items from BOM in Material Request, I noticed that the system default BOM select filter is docstatus=1, which means the BOM that submitted in system can be selected.
image

In our scenario, some of our BOMs are not in active but submitted already in system, we don’t want them to be able to select. which means if the default filter can be set to is_active=1 that can match my need.

So my question is , is there a way to change the default filter and meanwhile won’t break the bench update?

Thanks.

Nice catch! The Is Active filter is applied on the Stock Entry from BOM transactions, but not for the Material Request transactions.

I don’t think it should break the update if you modify the code related to the Material Request and then do git commit to the changes you did.

If you need help on which segment of the code to change, I can’t help you there, but somebody else will, hopefully. That same person can hopefully help you with the exact git commit commands.

Hope this helps.

Thanks

Jay

Thanks Jay.

And yes, I don’t have the information on how to commit the changes via git.
So appreciate someone who can help me commit the changes.

How to modify

Blockquote
vi $installation_root/apps/erpnext/erpnext/stock/doctype/material_request/material_request.js

196         get_items_from_bom: function(frm) {
197                 var d = new frappe.ui.Dialog({
198                         title: __("Get Items from BOM"),
199                         fields: [
200                                 {"fieldname":"bom", "fieldtype":"Link", "label":__("BOM"),
201                                         options:"BOM", reqd: 1, get_query: function() {
202                                                 return {filters: { docstatus:1 }};

line 202, replace docstatus to is_active

Thanks

You may need both docstatus and is_active.

You can go ahead and make the change. The only issue is when you run the update next you may have to run bench update --reset and then have to make these changes again.

Most likely in the meanwhile somebody else will point you to the exact git commit command so that you don’t have the update problem and the change stays.

Maybe you should put in a Github issue to fix this as part of the core. But once it does, you may have to run bench update --reset anyways. :slight_smile: It’s a little complicated. I guess!

Hope this helps.

Thanks

Jay

Thanks

Jay

Actually bench update --reset is not required.
One has to resolve conflicts of local and server copy of same file and keep local changes via git command.
I am forgetting exact sequence and command to do that, but one has to go and run the git command inside the /apps/erpnext directory.
But yes everytime an update is run, git conflict has to be resolved via git command to keep local changes.