From 6307cb2dac314dcf58d0116fe905f281f3bd95b5 Mon Sep 17 00:00:00 2001 From: Ashna-v Date: Wed, 18 Oct 2023 16:05:15 +0530 Subject: [PATCH] feat:Added a All smith warehouse under All warehouses --- aumms/setup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aumms/setup.py b/aumms/setup.py index bc84af9c..a77b6d0f 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -13,6 +13,7 @@ def setup_aumms_defaults(): enable_common_party_accounting() create_default_aumms_item_group() create_old_gold_aumms_item_group() + create_all_smith_warehouse() def enable_common_party_accounting(): """ @@ -49,3 +50,16 @@ def create_old_gold_aumms_item_group(): aumms_item_group_doc.parent_aumms_item_group = 'All AuMMS Item Group' aumms_item_group_doc.insert(ignore_permissions = True) frappe.db.commit() + +def create_all_smith_warehouse(): + ''' Method to create default All Smith Warehouse on after migrate ''' + default_company = frappe.db.get_single_value('Global Defaults', 'default_company') + warehouse = frappe.get_value('Warehouse',{'warehouse_name': 'All Warehouses'}) + if not frappe.db.exists('Warehouse', {'warehouse_name': 'All Smith Warehouse'}): + warehouse_doc = frappe.new_doc('Warehouse') + warehouse_doc.company = default_company + warehouse_doc.warehouse_name = 'All smith Warehouse' + warehouse_doc.parent_warehouse = warehouse + warehouse_doc.is_group = 1 + warehouse_doc.insert(ignore_permissions = True) + frappe.db.commit()