1+ import frappe
12from bloomstack_core .bloomtrace import get_bloomtrace_client
23from frappe .utils import get_host_name
34
@@ -11,16 +12,37 @@ def sync_bloomtrace(compliance_settings, method):
1112 return
1213
1314 site_url = get_host_name ()
14- frappe_client .update ({
15- "doctype" : "Bloomstack Site" ,
16- "name" : site_url
17- })
1815
19- for company in compliance_settings . company :
16+ try :
2017 frappe_client .update ({
21- "doctype" : "Bloomstack Company" ,
22- "name" : company .company ,
23- "metrc_push_data" : company .push_data ,
24- "metrc_pull_data" : company .pull_data ,
25- "pull_incoming_transfer" : company .pull_incoming_transfer
18+ "doctype" : "Bloomstack Site" ,
19+ "name" : site_url ,
20+ "metrc_user_key" : compliance_settings .get_password ("metrc_user_key" )
2621 })
22+ except Exception as e :
23+ frappe .log_error (e )
24+
25+ for company in compliance_settings .company :
26+ try :
27+ frappe_client .update ({
28+ "doctype" : "Bloomstack Company" ,
29+ "name" : company .company ,
30+ "push_item" : company .push_item ,
31+ "pull_item" : company .pull_item ,
32+ "push_package_tag" : company .push_package_tag ,
33+ "pull_package_tag" : company .pull_package_tag ,
34+ "pull_transfer" : company .pull_transfer ,
35+ "push_transfer" : company .push_transfer ,
36+ "pull_plant" : company .pull_plant ,
37+ "push_plant" : company .push_plant ,
38+ "pull_plant_batch" : company .pull_plant_batch ,
39+ "push_plant_batch" : company .push_plant_batch ,
40+ "pull_strain" : company .pull_strain ,
41+ "push_strain" : company .push_strain ,
42+ "pull_harvest" : company .pull_harvest ,
43+ "push_harvest" : company .push_harvest ,
44+ "pull_package" : company .pull_package ,
45+ "push_package" : company .push_package
46+ })
47+ except Exception as e :
48+ frappe .log_error (e )
0 commit comments