mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-17 09:17:15 +00:00
fix: Company might not have any warehouses when on_update hook for QBM is being executed
This used to throw while renaming a Company that is either used with QuickBooks Migrator or is set as a Default Company in Global Defaults.
This commit is contained in:
@@ -47,7 +47,9 @@ class QuickBooksMigrator(Document):
|
||||
if self.company:
|
||||
# We need a Cost Center corresponding to the selected erpnext Company
|
||||
self.default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
|
||||
self.default_warehouse = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0})[0]["name"]
|
||||
company_warehouses = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0})
|
||||
if company_warehouses:
|
||||
self.default_warehouse = company_warehouses[0].name
|
||||
if self.authorization_endpoint:
|
||||
self.authorization_url = self.oauth.authorization_url(self.authorization_endpoint)[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user