amendDoc<T extends FrappeDocument> method

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

Clones a doc, set amended_from property to the original doc.

Implementation

@override
T amendDoc<T extends FrappeDocument>(T doc) {
  EmptyDoctypeError.verify(doc.doctype);
  EmptyDocNameError.verify(doc.name);

  if (doc.docStatus != FrappeDocStatus.Submitted) {
    throw NotASubmittedDocument();
  }
  final newDoc = copyDoc(doc);
  newDoc.amendedFrom = doc.name;
  return newDoc;
}