diff --git a/india_compliance/patches/post_install/add_einvoice_status_field.py b/india_compliance/patches/post_install/add_einvoice_status_field.py index a9a0916245..cccec95d12 100644 --- a/india_compliance/patches/post_install/add_einvoice_status_field.py +++ b/india_compliance/patches/post_install/add_einvoice_status_field.py @@ -8,7 +8,7 @@ def execute(): # and E Invoice Settings should be enabled if not frappe.db.has_column("Sales Invoice", "signed_einvoice") or not sbool( - frappe.db.get_value("E Invoice Settings", "E Invoice Settings", "enable", ignore=True) + frappe.db.get_single_value("E Invoice Settings", "enable", ignore=True) ): set_not_applicable_status() return diff --git a/india_compliance/patches/post_install/update_reverse_charge_and_export_type.py b/india_compliance/patches/post_install/update_reverse_charge_and_export_type.py index a8cd6a853a..52521b64c7 100644 --- a/india_compliance/patches/post_install/update_reverse_charge_and_export_type.py +++ b/india_compliance/patches/post_install/update_reverse_charge_and_export_type.py @@ -4,16 +4,18 @@ DOCTYPES = ("Purchase Invoice", "Sales Invoice") -DOCTYPE_COLUMNS = {doctype: frappe.db.get_table_columns(doctype) for doctype in DOCTYPES} - def execute(): - update_field_to_check("reverse_charge", "is_reverse_charge", "Y") - update_field_to_check("export_type", "is_export_with_gst", "With Payment of Tax") + doctype_columns = {doctype: frappe.db.get_table_columns(doctype) for doctype in DOCTYPES} + + update_field_to_check("reverse_charge", "is_reverse_charge", "Y", doctype_columns) + update_field_to_check( + "export_type", "is_export_with_gst", "With Payment of Tax", doctype_columns + ) -def update_field_to_check(old_fieldname, new_fieldname, truthy_value): - for doctype, columns in DOCTYPE_COLUMNS.items(): +def update_field_to_check(old_fieldname, new_fieldname, truthy_value, doctype_columns): + for doctype, columns in doctype_columns.items(): # Check for new fieldname, is_export_with_gst is only applicable for Sales Invoice if old_fieldname not in columns or new_fieldname not in columns: continue diff --git a/india_compliance/vat_india/doctype/c_form/c_form.py b/india_compliance/vat_india/doctype/c_form/c_form.py index 665c72e184..372ec2f31c 100644 --- a/india_compliance/vat_india/doctype/c_form/c_form.py +++ b/india_compliance/vat_india/doctype/c_form/c_form.py @@ -29,10 +29,10 @@ def validate(self): elif inv and inv[0][1] and inv[0][1] != self.name: frappe.throw( _( - f"""Invoice {d.invoice_no} is tagged in another C-form: {inv[0][1]}. + """Invoice {0} is tagged in another C-form: {1}. If you want to change C-form no for this invoice, please remove invoice no from the previous c-form and then try again""" - ) + ).format(d.invoice_no, inv[0][1]) ) elif not inv: