diff --git a/print_designer/patches.txt b/print_designer/patches.txt index dd569f3..5cd0b74 100644 --- a/print_designer/patches.txt +++ b/print_designer/patches.txt @@ -1,3 +1,8 @@ +[pre_model_sync] +print_designer.patches.introduce_dynamic_containers +execute:from print_designer.patches.create_custom_fields import custom_field_patch; custom_field_patch() #208 + +[post_model_sync] print_designer.patches.update_white_space_property print_designer.patches.introduce_barcode print_designer.patches.introduce_jinja @@ -6,9 +11,7 @@ print_designer.patches.rerun_introduce_jinja print_designer.patches.introduce_table_alt_row_styles print_designer.patches.introduce_column_style print_designer.patches.introduce_suffix_dynamic_content -print_designer.patches.introduce_dynamic_containers print_designer.patches.introduce_dynamic_height print_designer.patches.remove_unused_rectangle_gs_properties -execute:from print_designer.patches.create_custom_fields import custom_field_patch; custom_field_patch() print_designer.patches.change_dynamic_height_variable print_designer.patches.introduce_z_index diff --git a/print_designer/patches/patch_utils.py b/print_designer/patches/patch_utils.py index 1ad872b..41a8253 100644 --- a/print_designer/patches/patch_utils.py +++ b/print_designer/patches/patch_utils.py @@ -109,6 +109,7 @@ def patch_formats( for pf in print_formats: print_json = pf[5] or "{}" # print_designer_print_format was introduced in schema version 1.1.0 so running this on older version is not required + pf_doc = frappe.get_doc("Print Format", pf[0]) if update_print_json and not is_older_schema( settings=frappe.json.loads(pf[6] or "{}"), current_version="1.1.0" ): @@ -120,8 +121,9 @@ def patch_formats( if print_json.get("footer", None): print_json["footer"] = patch_elements(print_json["footer"], callbacks, types) print_json = frappe.json.dumps(print_json) + pf_doc.update({"print_designer_print_format": print_json}) - updated_doc = frappe.get_doc("Print Format", pf[0]).update( + pf_doc.update( { "print_designer_header": frappe.json.dumps( patch_elements(frappe.json.loads(pf[1] or "[]"), callbacks, types) @@ -135,11 +137,10 @@ def patch_formats( "print_designer_footer": frappe.json.dumps( patch_elements(frappe.json.loads(pf[4] or "[]"), callbacks, types) ), - "print_designer_print_format": print_json, } ) if save: - updated_doc.save(ignore_permissions=True, ignore_version=False) + pf_doc.save(ignore_permissions=True, ignore_version=False) def patch_elements(