newDoc<T extends FrappeDocument> method
Returns a new instance of T
document with a new name based on getNewName.
It also adds the new doc to the local cache using addToLocals.
Implementation
@override
T newDoc<T extends FrappeDocument>(T doc) {
EmptyDoctypeError.verify(doc.doctype);
doc.name = getNewName(doc.doctype!);
doc.isLocal = true;
doc.unsaved = true;
doc.rawResponse = <String, dynamic>{
if (doc.rawResponse != null) ...doc.rawResponse!,
...doc.toJson(),
};
addToLocals(doc);
return doc;
}