Merge pull request #13 from root/dev
ajout des conditions pour générer PO (demande achats)
This commit is contained in:
@@ -78,6 +78,23 @@ public class PurchaseRequestController {
|
||||
.all()
|
||||
.filter("self.id in (?1)", requestIds)
|
||||
.fetch();
|
||||
// sophal
|
||||
int condition = 0;
|
||||
String message = "";
|
||||
for (PurchaseRequest result : purchaseRequests) {
|
||||
if(result.getStatusSelect() != 5){
|
||||
condition = 1;
|
||||
message = "purchase request not approved";
|
||||
break;
|
||||
}
|
||||
if(result.getPurchaseOrderSet().size() > 0){
|
||||
condition = 1;
|
||||
message = "you have already generated this purchase request";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( condition == 0){
|
||||
List<String> purchaseRequestSeqs =
|
||||
purchaseRequests
|
||||
.stream()
|
||||
@@ -106,6 +123,11 @@ public class PurchaseRequestController {
|
||||
String.format(
|
||||
"self.id in (%s)", StringTool.getIdListString(purchaseOrderList)));
|
||||
response.setView(actionViewBuilder.map());
|
||||
|
||||
}else{
|
||||
response.setAlert(I18n.get(message));
|
||||
}
|
||||
|
||||
} catch (AxelorException e) {
|
||||
response.setFlash(e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user