diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 62a04f37b11..df143eefa0d 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -58,7 +58,9 @@ class Supplier(TransactionBase): frappe.db.set(self, "supplier_name", newdn) def create_onboarding_docs(self, args): - defaults = frappe.defaults.get_defaults() + company = frappe.defaults.get_defaults().get('company') or \ + frappe.db.get_single_value('Global Defaults', 'default_company') + for i in range(1, args.get('max_count')): supplier = args.get('supplier_name_' + str(i)) if supplier: @@ -67,7 +69,7 @@ class Supplier(TransactionBase): 'doctype': self.doctype, 'supplier_name': supplier, 'supplier_group': _('Local'), - 'company': defaults.get('company') + 'company': company }).insert() if args.get('supplier_email_' + str(i)): diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 7f2fe60f595..9261289773d 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -213,6 +213,9 @@ class Customer(TransactionBase): def create_onboarding_docs(self, args): defaults = frappe.defaults.get_defaults() + company = defaults.get('company') or \ + frappe.db.get_single_value('Global Defaults', 'default_company') + for i in range(1, args.get('max_count')): customer = args.get('customer_name_' + str(i)) if customer: @@ -223,7 +226,7 @@ class Customer(TransactionBase): 'customer_type': 'Company', 'customer_group': _('Commercial'), 'territory': defaults.get('country'), - 'company': defaults.get('company') + 'company': company }).insert() if args.get('customer_email_' + str(i)): diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d036a0a1fb4..a2a913a73f5 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -877,14 +877,16 @@ class Item(WebsiteGenerator): frappe.msgprint(msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."), title=_("Enable Auto Re-Order"), indicator="orange") def create_onboarding_docs(self, args): - defaults = frappe.defaults.get_defaults() + company = frappe.defaults.get_defaults().get('company') or \ + frappe.db.get_single_value('Global Defaults', 'default_company') + for i in range(1, args.get('max_count')): item = args.get('item_' + str(i)) if item: default_warehouse = '' default_warehouse = frappe.db.get_value('Warehouse', filters={ 'warehouse_name': _('Finished Goods'), - 'company': defaults.get('company_name') + 'company': company }) try: @@ -901,7 +903,7 @@ class Item(WebsiteGenerator): 'stock_uom': _(args.get('item_uom_' + str(i))), 'item_defaults': [{ 'default_warehouse': default_warehouse, - 'company': defaults.get('company_name') + 'company': company }] }).insert() @@ -909,7 +911,7 @@ class Item(WebsiteGenerator): pass else: if args.get('item_price_' + str(i)): - item_price = flt(args.get('tem_price_' + str(i))) + item_price = flt(args.get('item_price_' + str(i))) price_list_name = frappe.db.get_value('Price List', {'selling': 1}) make_item_price(item, price_list_name, item_price)