duplicate method

OdooGroup duplicate()

Returns a deep copy with a fresh ID (used when duplicating)

Implementation

OdooGroup duplicate() {
  final now = DateTime.now();
  return OdooGroup(
    id: const Uuid().v4(),
    label: label != null ? '$label (copy)' : null,
    fields: fields.map((f) => f.copyWith(id: const Uuid().v4())).toList(),
    subGroups: subGroups.map((g) => g.duplicate()).toList(),
    colspan: colspan,
    fillBrk: fillBrk,
    expand: expand,
    expandButtonLabel: expandButtonLabel,
    col: col,
    groups: groups,
    invisible: invisible,
    attrs: attrs,
    nestingLevel: nestingLevel,
    createdAt: now,
    updatedAt: now,
  );
}