Environment
- ERPNext: 15.102.0
- Frappe: 15.103.1
- URY: 0.2.1
Bug 1: Missing imports in ury_table.py
Error
NameError: name 're' is not defined
Location
ury/ury/doctype/ury_table/ury_table.py — autoname() method
Cause
re and make_autoname are used but never imported.
Fix
import re
from frappe.model.naming import make_autoname
Bug 2: Apostrophe in restaurant name breaks naming series
Error
InvalidNamingSeriesError: Special Characters except '-', '#', '.',
'/', '{' and '}' not allowed in naming series Victoria's-.##
Cause
self.restaurant.replace(" ", "-") strips spaces but not apostrophes,
causing the naming series to contain an invalid ' character.
Fix
prefix = re.sub("-+", "-", re.sub(r"[^a-zA-Z0-9-]", "",
self.restaurant.replace(" ", "-")))
Fixed file
import re
from frappe.model.naming import make_autoname
import frappe
from frappe.model.document import Document
class URYTable(Document):
def autoname(self):
prefix = re.sub("-+", "-", re.sub(r"[^a-zA-Z0-9-]", "",
self.restaurant.replace(" ", "-")))
self.name = make_autoname(prefix + "-.##")
Environment
Bug 1: Missing imports in ury_table.py
Error
Location
ury/ury/doctype/ury_table/ury_table.py—autoname()methodCause
reandmake_autonameare used but never imported.Fix
Bug 2: Apostrophe in restaurant name breaks naming series
Error
Cause
self.restaurant.replace(" ", "-")strips spaces but not apostrophes,causing the naming series to contain an invalid
'character.Fix
Fixed file