fix generate purchase order set && update price calculation
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -45,3 +45,5 @@ hs_err_pid*
|
||||
|
||||
# JavaScript
|
||||
node_modules
|
||||
|
||||
src/main/resources/application.properties
|
||||
|
||||
@@ -32,8 +32,10 @@ import com.google.inject.persist.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PurchaseRequestServiceImpl implements PurchaseRequestService {
|
||||
@@ -121,6 +123,10 @@ public class PurchaseRequestServiceImpl implements PurchaseRequestService {
|
||||
purchaseOrder.getPurchaseOrderLineList().addAll(purchaseOrderLineList);
|
||||
purchaseOrderService.computePurchaseOrder(purchaseOrder);
|
||||
purchaseOrderRepo.save(purchaseOrder);
|
||||
Set<PurchaseOrder> hash_Set = new HashSet<PurchaseOrder>();
|
||||
hash_Set.add(purchaseOrder);
|
||||
purchaseRequest.setPurchaseOrderSet(hash_Set);
|
||||
purchaseRequestRepo.save(purchaseRequest);
|
||||
}
|
||||
List<PurchaseOrder> purchaseOrders =
|
||||
purchaseOrderMap.values().stream().collect(Collectors.toList());
|
||||
|
||||
@@ -195,7 +195,8 @@ public class PurchaseOrderController {
|
||||
purchaseOrderIdList.add(new Long((Integer) map.get("id")));
|
||||
}
|
||||
} else {
|
||||
// After confirmation popup, purchase order's id are in a string separated by ","
|
||||
// After confirmation popup, purchase order's id are in a string separated by
|
||||
// ","
|
||||
String purchaseOrderIdListStr = (String) request.getContext().get("purchaseOrderToMerge");
|
||||
for (String purchaseOrderId : purchaseOrderIdListStr.split(",")) {
|
||||
purchaseOrderIdList.add(new Long(purchaseOrderId));
|
||||
@@ -204,17 +205,20 @@ public class PurchaseOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if currency, supplierPartner, company and tradingName are the same for all selected
|
||||
// Check if currency, supplierPartner, company and tradingName are the same for
|
||||
// all selected
|
||||
// purchase orders
|
||||
Currency commonCurrency = null;
|
||||
Partner commonSupplierPartner = null;
|
||||
Company commonCompany = null;
|
||||
Partner commonContactPartner = null;
|
||||
TradingName commonTradingName = null;
|
||||
// Useful to determine if a difference exists between contact partners of all purchase orders
|
||||
// Useful to determine if a difference exists between contact partners of all
|
||||
// purchase orders
|
||||
boolean existContactPartnerDiff = false;
|
||||
PriceList commonPriceList = null;
|
||||
// Useful to determine if a difference exists between price lists of all purchase orders
|
||||
// Useful to determine if a difference exists between price lists of all
|
||||
// purchase orders
|
||||
boolean existPriceListDiff = false;
|
||||
PurchaseOrder purchaseOrderTemp;
|
||||
boolean allTradingNamesAreNull = true;
|
||||
@@ -404,6 +408,18 @@ public class PurchaseOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
|
||||
purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
|
||||
Beans.get(PurchaseOrderService.class).computePurchaseOrder(purchaseOrder);
|
||||
Beans.get(PurchaseOrderService.class).updateCostPrice(purchaseOrder);
|
||||
response.setReload(true);
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on printing settings select. Set the domain for {@link PurchaseOrder#printingSettings}
|
||||
*
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
# ~~~~~
|
||||
db.default.driver = org.postgresql.Driver
|
||||
db.default.ddl = update
|
||||
db.default.url = jdbc:postgresql://localhost:5432/bdd_sophal
|
||||
db.default.url = jdbc:postgresql://localhost:5432/axelor_code
|
||||
db.default.user = postgres
|
||||
db.default.password = root
|
||||
db.default.password = admin
|
||||
|
||||
# Application Information
|
||||
# ~~~~~
|
||||
|
||||
Reference in New Issue
Block a user