use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class ExpenseServiceImpl method setExpenseSeq.
private void setExpenseSeq(Expense expense) throws AxelorException {
if (!Beans.get(SequenceService.class).isEmptyOrDraftSequenceNumber(expense.getExpenseSeq())) {
return;
}
HRConfig hrConfig = hrConfigService.getHRConfig(expense.getCompany());
Sequence sequence = hrConfigService.getExpenseSequence(hrConfig);
if (sequence != null) {
expense.setExpenseSeq(Beans.get(SequenceService.class).getSequenceNumber(sequence, expense.getSentDate()));
if (expense.getExpenseSeq() != null) {
return;
}
}
throw new AxelorException(expense, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.HR_CONFIG_NO_EXPENSE_SEQUENCE), expense.getCompany().getName());
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class ImportSequence method importSequence.
@Transactional(rollbackOn = Exception.class)
public Object importSequence(Object bean, Map<String, Object> values) throws AxelorException {
assert bean instanceof Sequence;
Sequence sequence = (Sequence) bean;
sequence.setFullName(sequenceService.computeFullName(sequence));
SequenceVersion seqVersion = sequenceService.getVersion(sequence, LocalDate.now());
sequenceVersionRepository.save(seqVersion);
sequence.setVersion(seqVersion.getId().intValue());
sequenceRepository.save(sequence);
return sequence;
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class BankOrderServiceImpl method generateSequence.
@Override
@Transactional(rollbackOn = { Exception.class })
public BankOrder generateSequence(BankOrder bankOrder) throws AxelorException {
if (bankOrder.getBankOrderSeq() == null) {
Sequence sequence = getSequence(bankOrder);
setBankOrderSeq(bankOrder, sequence);
bankOrderRepo.save(bankOrder);
}
return bankOrder;
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class SequenceController method getDefaultTitle.
public void getDefaultTitle(ActionRequest request, ActionResponse response) {
Sequence sequence = request.getContext().asType(Sequence.class);
if (!Strings.isNullOrEmpty(sequence.getCodeSelect())) {
String defautlTitle = Beans.get(SequenceService.class).getDefaultTitle(sequence);
response.setValue("name", I18n.get(defautlTitle));
}
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class SequenceController method computeFullName.
public void computeFullName(ActionRequest request, ActionResponse response) {
Sequence sequence = request.getContext().asType(Sequence.class);
String fullName = Beans.get(SequenceService.class).computeFullName(sequence);
response.setValue("fullName", fullName);
}
Aggregations