Merge pull request #21087 from nabinhait/item_defaults_fix_dev

fix: Add item defaults based on global settings only if default company and warehouse is mentioned
This commit is contained in:
Deepesh Garg 2020-03-29 21:55:25 +05:30 committed by GitHub
commit a47e42c515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -741,14 +741,12 @@ class Item(WebsiteGenerator):
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",
if defaults.get("default_warehouse") and defaults.company 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
})
self.append("item_defaults", {
"company": defaults.get("company"),
"default_warehouse": defaults.default_warehouse
})
def update_variants(self):
if self.flags.dont_update_variants or \