@@ -491,8 +491,8 @@ def submit_configure_data(data):
491491 pos_doc = frappe .get_doc (pos_dict )
492492
493493 if tax_template_name :
494- if frappe .db .exists ("URY Restaurant" , f" { branch_name } Restaurant" ):
495- frappe .db .set_value ("URY Restaurant" , f" { branch_name } Restaurant" , "default_tax_template" , tax_template_name )
494+ if frappe .db .exists ("URY Restaurant" , restaurant_name ):
495+ frappe .db .set_value ("URY Restaurant" , restaurant_name , "default_tax_template" , tax_template_name )
496496
497497 pos_doc .insert (ignore_permissions = True )
498498 results ["pos_profile" ] = pos_doc .name
@@ -523,6 +523,21 @@ def submit_configure_data(data):
523523 setattr (p_doc , k , v )
524524 p_doc .save (ignore_permissions = True )
525525 results ["pos_profile" ] = pos_profile_name
526+
527+ # Create URY Production Unit
528+ production_unit_name = f"Kitchen - { branch_name } "
529+ if not frappe .db .exists ("URY Production Unit" , production_unit_name ):
530+ prod_doc = frappe .get_doc ({
531+ "doctype" : "URY Production Unit" ,
532+ "production" : production_unit_name ,
533+ "pos_profile" : pos_profile_name ,
534+ "branch" : branch_name ,
535+ "warehouse" : warehouse_name ,
536+ "item_groups" : [{"item_group" : item_group }]
537+ })
538+ prod_doc .insert (ignore_permissions = True )
539+ results ["production_unit" ] = prod_doc .name
540+
526541 except Exception as e :
527542 frappe .log_error (frappe .get_traceback (), "Failed to create POS Profile" )
528543 results ["pos_profile_error" ] = str (e )
0 commit comments