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()
|
.all()
|
||||||
.filter("self.id in (?1)", requestIds)
|
.filter("self.id in (?1)", requestIds)
|
||||||
.fetch();
|
.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 =
|
List<String> purchaseRequestSeqs =
|
||||||
purchaseRequests
|
purchaseRequests
|
||||||
.stream()
|
.stream()
|
||||||
@@ -106,6 +123,11 @@ public class PurchaseRequestController {
|
|||||||
String.format(
|
String.format(
|
||||||
"self.id in (%s)", StringTool.getIdListString(purchaseOrderList)));
|
"self.id in (%s)", StringTool.getIdListString(purchaseOrderList)));
|
||||||
response.setView(actionViewBuilder.map());
|
response.setView(actionViewBuilder.map());
|
||||||
|
|
||||||
|
}else{
|
||||||
|
response.setAlert(I18n.get(message));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (AxelorException e) {
|
} catch (AxelorException e) {
|
||||||
response.setFlash(e.getMessage());
|
response.setFlash(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user