use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialServiceImpl method generateNewVersion.
@Override
@Transactional
public BillOfMaterial generateNewVersion(BillOfMaterial billOfMaterial) {
BillOfMaterial copy = billOfMaterialRepo.copy(billOfMaterial, true);
copy.setOriginalBillOfMaterial(billOfMaterial);
copy.clearCostSheetList();
copy.setCostPrice(BigDecimal.ZERO);
copy.setOriginalBillOfMaterial(billOfMaterial);
copy.setVersionNumber(this.getLatestBillOfMaterialVersion(billOfMaterial, billOfMaterial.getVersionNumber(), true) + 1);
return billOfMaterialRepo.save(copy);
}
Aggregations