I’m following tutorial and I got to the point where I’m editing LibraryMembership
class to check
if the member already has a membership active.
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.docstatus import DocStatus
class LibraryMembership(Document):
def before_submit(self):
exists = frappe.db.exists(
'Library Membership',
{
'library_member': self.library_member,
'docstatus': DocStatus.submitted(),
'to_date': ('>', self.from_date),
},
)
if exists:
frappe.throw('There\'s an active membership for this member.')
When I give it a ride to see it in action I get import error:
ModuleNotFoundError: No module named 'frappe.model.docstatus'
I’ve checked the source code for bench to see if the imports haven’t changed (which is unlikely since I downloaded latest release) and I could clearly see the import is valid.
Any suggestions ?