Skip to content

Commit

Permalink
chore: fix some linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarvora committed Apr 5, 2024
1 parent e5645d3 commit 5fbb832
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions india_compliance/vat_india/doctype/c_form/c_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5fbb832

Please sign in to comment.