Default warehouse for multi-company setup script problem

Hi, I’m trying to define a default delivery warehouse for each company as opposed to each item. I’m following this: Company wise default warehouse · Issue #3394 · frappe/erpnext · GitHub which states to do this:

First you need to add custom field “default_warehouse” to Customer and Sales Order doctype, then e.g. for Sales Order you need to add a custom script like:

cur_frm.add_fetch(“customer”, “default_warehouse”, “default_warehouse”);

frappe.ui.form.on(“Sales Order Item”, “item_code”, function(frm, cdt, cdn) {
if (!frm.cur_grid.doc.warehouse) {
frm.cur_grid.doc.warehouse = frm.doc.default_warehouse;

I changed customer to company to work with my scenario. The problem I get is that for whatever reason when I add an item to my sales order item list the item name, UOM, and description aren’t there anymore and I get an error that they are mandatory fields (which they are). I just don’t know why they were “blanked” out by this code. Any suggestions for a to this code?

cur_frm.add_fetch("customer", "default_warehouse", "default_warehouse");

This will only work if Customer field is in the child table of Sales Order Item table. Please create Github Issue for the feature of Company wise default warehouse. If possible, we will add this feature in the product itself.