Merge pull request #17686 from rohitwaghchaure/set_default_warehouse_from_the_stock_settings

fix: while making the item, default warehouse not set even if the stock settings has the default warehouse
This commit is contained in:
Saurabh
2019-05-21 12:52:51 +05:30
committed by GitHub

View File

@@ -691,7 +691,18 @@ class Item(WebsiteGenerator):
'income_account': item.income_account
})
else:
self.append("item_defaults", {"company": frappe.defaults.get_defaults().company})
warehouse = ''
defaults = frappe.defaults.get_defaults() or {}
# To check default warehouse is belong to the default company
if defaults.get("default_warehouse") and frappe.db.exists("Warehouse",
{'name': defaults.default_warehouse, 'company': defaults.company}):
warehouse = defaults.default_warehouse
self.append("item_defaults", {
"company": defaults.get("company"),
"default_warehouse": warehouse
})
def update_variants(self):
if self.flags.dont_update_variants or \