diff --git a/frappe/database/sequence.py b/frappe/database/sequence.py index c89ba468bc..334fd3d71e 100644 --- a/frappe/database/sequence.py +++ b/frappe/database/sequence.py @@ -69,8 +69,12 @@ def set_next_val( is_val_used :bool = False ) -> None: - is_val_used = 0 if not is_val_used else 1 + if not is_val_used: + is_val_used = 0 if db.db_type == "mariadb" else "f" + else: + is_val_used = 1 if db.db_type == "mariadb" else "t" + if db.db_type == "postgres": - db.sql(f"SELECT SETVAL(\'\"{scrub(doctype_name + slug)}\"\', {next_val}, {is_val_used})") + db.sql(f"SELECT SETVAL('\"{scrub(doctype_name + slug)}\"', {next_val}, '{is_val_used}')") else: db.sql(f"SELECT SETVAL(`{scrub(doctype_name + slug)}`, {next_val}, {is_val_used})") diff --git a/frappe/model/naming.py b/frappe/model/naming.py index 25b548cac3..7e807f424e 100644 --- a/frappe/model/naming.py +++ b/frappe/model/naming.py @@ -329,7 +329,7 @@ def validate_name(doctype: str, name: Union[int, str], case: Optional[str] = Non set_next_val(doctype, name, is_val_used=True) return name - frappe.throw("Invalid name type (integer) for varchar name column") + frappe.throw(_("Invalid name type (integer) for varchar name column"), frappe.NameError) if name.startswith("New "+doctype): frappe.throw(_("There were some errors setting the name, please contact the administrator"), frappe.NameError)