fix: use set_value instead of sql

This commit is contained in:
barredterra 2021-03-03 12:33:48 +01:00
parent 82c6223196
commit 1521b31795
3 changed files with 5 additions and 7 deletions

View File

@ -105,8 +105,9 @@ def add_print_formats():
frappe.reload_doc("accounts", "print_format", "gst_pos_invoice")
frappe.reload_doc("accounts", "print_format", "GST E-Invoice")
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
name in('GST POS Invoice', 'GST Tax Invoice', 'GST E-Invoice') """)
frappe.db.set_value("Print Format", "GST POS Invoice", "disabled", 0)
frappe.db.set_value("Print Format", "GST Tax Invoice", "disabled", 0)
frappe.db.set_value("Print Format", "GST E-Invoice", "disabled", 0)
def make_custom_fields(update=True):
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',

View File

@ -189,9 +189,7 @@ def make_custom_fields(update=True):
def setup_report():
report_name = 'Electronic Invoice Register'
frappe.db.sql(""" update `tabReport` set disabled = 0 where
name = %s """, report_name)
frappe.db.set_value("Report", report_name, "disabled", 0)
if not frappe.db.get_value('Custom Role', dict(report=report_name)):
frappe.get_doc(dict(

View File

@ -36,5 +36,4 @@ def make_custom_fields(update=True):
def add_print_formats():
frappe.reload_doc("regional", "print_format", "irs_1099_form")
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
name in('IRS 1099 Form') """)
frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)