use of com.axelor.apps.crm.db.Opportunity in project axelor-open-suite by axelor.
the class OpportunityController method createClient.
public void createClient(ActionRequest request, ActionResponse response) {
try {
Opportunity opportunity = request.getContext().asType(Opportunity.class);
opportunity = Beans.get(OpportunityRepository.class).find(opportunity.getId());
Beans.get(OpportunityService.class).createClientFromLead(opportunity);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(e);
response.setError(e.getMessage());
}
}
use of com.axelor.apps.crm.db.Opportunity in project axelor-open-suite by axelor.
the class OpportunitySaleOrderController method generateSaleOrder.
public void generateSaleOrder(ActionRequest request, ActionResponse response) throws AxelorException {
Opportunity opportunity = request.getContext().asType(Opportunity.class);
opportunity = Beans.get(OpportunityRepository.class).find(opportunity.getId());
SaleOrder saleOrder = Beans.get(OpportunitySaleOrderService.class).createSaleOrderFromOpportunity(opportunity);
response.setReload(true);
response.setView(ActionView.define(I18n.get(ITranslation.SALE_QUOTATION)).model(SaleOrder.class.getName()).add("form", "sale-order-form").param("forceEdit", "true").param("forceTitle", "true").context("_showRecord", String.valueOf(saleOrder.getId())).map());
}
use of com.axelor.apps.crm.db.Opportunity in project axelor-open-suite by axelor.
the class SaleOrderWorkflowServiceImpl method confirmSaleOrder.
@Override
@Transactional(rollbackOn = { Exception.class })
public void confirmSaleOrder(SaleOrder saleOrder) throws AxelorException {
saleOrder.setStatusSelect(SaleOrderRepository.STATUS_ORDER_CONFIRMED);
saleOrder.setConfirmationDateTime(appSaleService.getTodayDateTime().toLocalDateTime());
saleOrder.setConfirmedByUser(userService.getUser());
this.validateCustomer(saleOrder);
if (appSaleService.getAppSale().getCloseOpportunityUponSaleOrderConfirmation()) {
Opportunity opportunity = saleOrder.getOpportunity();
if (opportunity != null) {
opportunity.setSalesStageSelect(OpportunityRepository.SALES_STAGE_CLOSED_WON);
}
}
saleOrderRepo.save(saleOrder);
}
use of com.axelor.apps.crm.db.Opportunity in project axelor-open-suite by axelor.
the class OpportunityManagementRepository method copy.
@Override
public Opportunity copy(Opportunity entity, boolean deep) {
Opportunity copy = super.copy(entity, deep);
copy.setSalesStageSelect(OpportunityRepository.SALES_STAGE_NEW);
copy.setLostReason(null);
copy.setOpportunitySeq(null);
return copy;
}
Aggregations