copyDoc<T extends FrappeDocument> method

  1. @override
T copyDoc<T extends FrappeDocument>(
  1. T doc
)
override

Returns a cloned doc, with a new local name.

Implementation

@override
T copyDoc<T extends FrappeDocument>(T doc) {
  EmptyDoctypeError.verify(doc.doctype);
  final clone = JSONAble.clone<T>(doc);
  clone.name = getNewName(doc.doctype!);
  clone.docStatus = FrappeDocStatus.Draft;
  clone.isLocal = true;
  clone.unsaved = true;
  addToLocals(clone);
  return clone;
}