use of com.axelor.apps.sale.db.SaleOrderLine in project axelor-open-suite by axelor.
the class SaleOrderLineController method computeProductDomain.
/**
* Called from sale order line form view, on product selection. Call {@link
* SaleOrderLineService#computeProductDomain(SaleOrderLine, SaleOrder)}.
*
* @param request
* @param response
*/
public void computeProductDomain(ActionRequest request, ActionResponse response) {
try {
Context context = request.getContext();
SaleOrderLine saleOrderLine = context.asType(SaleOrderLine.class);
SaleOrderLineService saleOrderLineService = Beans.get(SaleOrderLineService.class);
SaleOrder saleOrder = saleOrderLineService.getSaleOrder(context);
response.setAttr("product", "domain", saleOrderLineService.computeProductDomain(saleOrderLine, saleOrder));
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.sale.db.SaleOrderLine in project axelor-open-suite by axelor.
the class SaleOrderLineController method getTaxEquiv.
public void getTaxEquiv(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
SaleOrderLine saleOrderLine = context.asType(SaleOrderLine.class);
SaleOrder saleOrder = Beans.get(SaleOrderLineService.class).getSaleOrder(context);
response.setValue("taxEquiv", null);
if (saleOrder == null || saleOrderLine == null || saleOrder.getClientPartner() == null || saleOrderLine.getTaxLine() == null)
return;
response.setValue("taxEquiv", Beans.get(FiscalPositionService.class).getTaxEquiv(saleOrder.getClientPartner().getFiscalPosition(), saleOrderLine.getTaxLine().getTax()));
}
use of com.axelor.apps.sale.db.SaleOrderLine in project axelor-open-suite by axelor.
the class ImportSaleOrderLine method importSaleOrderLine.
public Object importSaleOrderLine(Object bean, Map<String, Object> values) throws AxelorException {
assert bean instanceof SaleOrderLine;
SaleOrderLine saleOrderLine = (SaleOrderLine) bean;
SaleOrderLineService saleOrderLineService = Beans.get(SaleOrderLineService.class);
saleOrderLine.setTaxLine(saleOrderLineService.getTaxLine(saleOrderLine.getSaleOrder(), saleOrderLine));
saleOrderLineService.computeValues(saleOrderLine.getSaleOrder(), saleOrderLine);
return saleOrderLine;
}
use of com.axelor.apps.sale.db.SaleOrderLine in project axelor-open-suite by axelor.
the class ProductionOrderSaleOrderServiceImpl method generateProductionOrder.
@Override
@Transactional(rollbackOn = { AxelorException.class })
public List<Long> generateProductionOrder(SaleOrder saleOrder) throws AxelorException {
boolean oneProdOrderPerSO = appProductionService.getAppProduction().getOneProdOrderPerSO();
List<Long> productionOrderIdList = new ArrayList<>();
if (saleOrder.getSaleOrderLineList() == null) {
return productionOrderIdList;
}
ProductionOrder productionOrder = null;
for (SaleOrderLine saleOrderLine : saleOrder.getSaleOrderLineList()) {
if (productionOrder == null || !oneProdOrderPerSO) {
productionOrder = this.createProductionOrder(saleOrder);
}
productionOrder = this.generateManufOrders(productionOrder, saleOrderLine);
if (productionOrder != null && !productionOrderIdList.contains(productionOrder.getId())) {
productionOrderIdList.add(productionOrder.getId());
}
}
return productionOrderIdList;
}
use of com.axelor.apps.sale.db.SaleOrderLine in project axelor-open-suite by axelor.
the class SaleOrderLineController method customizeBillOfMaterial.
public void customizeBillOfMaterial(ActionRequest request, ActionResponse response) {
try {
SaleOrderLine saleOrderLine = request.getContext().asType(SaleOrderLine.class);
BillOfMaterial copyBillOfMaterial = Beans.get(BillOfMaterialService.class).customizeBillOfMaterial(saleOrderLine);
if (copyBillOfMaterial != null) {
response.setValue("billOfMaterial", copyBillOfMaterial);
response.setFlash(I18n.get(IExceptionMessage.SALE_ORDER_LINE_1));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations