fix: while making the item, default warehouse not set even if the stock settings has the warehouse

This commit is contained in:
Rohit Waghchaure 2019-05-21 10:33:39 +05:30
parent c356fef9c4
commit 5e7b4ca6a4

View File

@ -723,7 +723,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 \