First commit (wating to add alerts in budget)
This commit is contained in:
@@ -35,8 +35,8 @@ import com.axelor.apps.purchase.service.PurchaseRequestServiceImpl;
|
||||
import com.axelor.apps.purchase.service.app.AppPurchaseService;
|
||||
import com.axelor.apps.purchase.service.app.AppPurchaseServiceImpl;
|
||||
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintService;
|
||||
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintService;
|
||||
import com.axelor.apps.purchase.service.print.PurchaseOrderPrintServiceImpl;
|
||||
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintService;
|
||||
import com.axelor.apps.purchase.service.print.PurchaseRequestPrintServiceImpl;
|
||||
|
||||
public class PurchaseModule extends AxelorModule {
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
package com.axelor.apps.purchase.service;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
|
||||
import com.axelor.apps.purchase.db.ImportationFolder;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrder;
|
||||
import com.axelor.exception.AxelorException;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
import wslite.json.JSONException;
|
||||
|
||||
public interface ImportationFolderService {
|
||||
|
||||
public void draftImportationFolder(ImportationFolder importationFolder);
|
||||
public void draftImportationFolder(ImportationFolder importationFolder);
|
||||
|
||||
public void openImportationFolder(ImportationFolder importationFolder) throws AxelorException;
|
||||
public void openImportationFolder(ImportationFolder importationFolder) throws AxelorException;
|
||||
|
||||
public void closeImportationFolder(ImportationFolder importationFolder);
|
||||
public void closeImportationFolder(ImportationFolder importationFolder);
|
||||
|
||||
public void cancelImportationFolder(ImportationFolder importationFolder);
|
||||
public void cancelImportationFolder(ImportationFolder importationFolder);
|
||||
|
||||
public void calculateSum(List<PurchaseOrder> purchaseOrders,ImportationFolder importationFolder) throws MalformedURLException, JSONException, AxelorException;
|
||||
}
|
||||
public void calculateSum(List<PurchaseOrder> purchaseOrders, ImportationFolder importationFolder)
|
||||
throws MalformedURLException, JSONException, AxelorException;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.math.BigDecimal;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import wslite.json.JSONException;
|
||||
|
||||
public class ImportationFolderServiceImpl implements ImportationFolderService {
|
||||
@@ -88,30 +87,27 @@ public class ImportationFolderServiceImpl implements ImportationFolderService {
|
||||
importationFolderRepository.save(importationFolder);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void calculateAvgPrice(List<PurchaseOrderLine> purchaseOrderLines, ImportationFolder importationFolder)
|
||||
public void calculateAvgPrice(
|
||||
List<PurchaseOrderLine> purchaseOrderLines, ImportationFolder importationFolder)
|
||||
throws MalformedURLException, JSONException, AxelorException {
|
||||
|
||||
|
||||
for (PurchaseOrderLine purchaseOrderLine : purchaseOrderLines) {
|
||||
|
||||
purchaseOrderLine.setPrice(purchaseOrderLine.getPrice().multiply(importationFolder.getCurrencyRate()));
|
||||
|
||||
purchaseOrderLine.setPrice(
|
||||
purchaseOrderLine.getPrice().multiply(importationFolder.getCurrencyRate()));
|
||||
|
||||
BigDecimal qty = purchaseOrderLine.getQty();
|
||||
purchaseOrderLine.setQty(purchaseOrderLine.getReceivedQty());
|
||||
Map<String, BigDecimal> map = Beans.get(PurchaseOrderLineService.class).compute(purchaseOrderLine, purchaseOrderLine.getPurchaseOrder());
|
||||
Map<String, BigDecimal> map =
|
||||
Beans.get(PurchaseOrderLineService.class)
|
||||
.compute(purchaseOrderLine, purchaseOrderLine.getPurchaseOrder());
|
||||
purchaseOrderLine.setExTaxTotal(map.get("exTaxTotal"));
|
||||
purchaseOrderLine.setInTaxTotal(map.get("inTaxTotal"));
|
||||
purchaseOrderLine.setQty(qty);
|
||||
Beans.get(PurchaseOrderLineRepository.class).save(purchaseOrderLine);
|
||||
|
||||
|
||||
}
|
||||
|
||||
importationFolderRepository.save(importationFolder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.db.Unit;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrder;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrderLine;
|
||||
import com.axelor.apps.purchase.db.PurchaseRequestLine;
|
||||
import com.axelor.apps.purchase.db.SupplierCatalog;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
@@ -83,6 +84,16 @@ public interface PurchaseOrderLineService {
|
||||
Unit unit)
|
||||
throws AxelorException;
|
||||
|
||||
public PurchaseOrderLine createPurchaseOrderLine(
|
||||
PurchaseOrder purchaseOrder,
|
||||
Product product,
|
||||
String productName,
|
||||
String description,
|
||||
BigDecimal qty,
|
||||
Unit unit,
|
||||
PurchaseRequestLine purchaseRequestLine)
|
||||
throws AxelorException;
|
||||
|
||||
public BigDecimal getQty(PurchaseOrder purchaseOrder, PurchaseOrderLine purchaseOrderLine);
|
||||
|
||||
public SupplierCatalog getSupplierCatalog(
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.axelor.apps.base.service.tax.AccountManagementService;
|
||||
import com.axelor.apps.base.service.tax.FiscalPositionService;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrder;
|
||||
import com.axelor.apps.purchase.db.PurchaseOrderLine;
|
||||
import com.axelor.apps.purchase.db.PurchaseRequestLine;
|
||||
import com.axelor.apps.purchase.db.SupplierCatalog;
|
||||
import com.axelor.apps.purchase.exception.IExceptionMessage;
|
||||
import com.axelor.apps.purchase.service.app.AppPurchaseService;
|
||||
@@ -158,7 +159,8 @@ public class PurchaseOrderLineServiceImpl implements PurchaseOrderLineService {
|
||||
BigDecimal amount =
|
||||
quantity
|
||||
.multiply(price)
|
||||
.setScale(AppBaseService.DEFAULT_NB_DECIMAL_DIGITS_SUPPLIER_LINE, RoundingMode.HALF_EVEN);
|
||||
.setScale(
|
||||
AppBaseService.DEFAULT_NB_DECIMAL_DIGITS_SUPPLIER_LINE, RoundingMode.HALF_EVEN);
|
||||
|
||||
LOG.debug(
|
||||
"Calcul du montant HT avec une quantité de {} pour {} : {}",
|
||||
@@ -726,4 +728,12 @@ public class PurchaseOrderLineServiceImpl implements PurchaseOrderLineService {
|
||||
product.getAllowToForcePurchaseQty(),
|
||||
response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PurchaseOrderLine createPurchaseOrderLine(PurchaseOrder purchaseOrder, Product product, String productName,
|
||||
String description, BigDecimal qty, Unit unit, PurchaseRequestLine purchaseRequestLine) throws AxelorException {
|
||||
PurchaseOrderLine purchaseOrderLine = this.createPurchaseOrderLine(purchaseOrder, product, productName, description, qty, unit);
|
||||
return purchaseOrderLine;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.axelor.apps.base.db.PriceList;
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.db.TradingName;
|
||||
import com.axelor.apps.base.db.Unit;
|
||||
import com.axelor.apps.base.db.Wizard;
|
||||
import com.axelor.apps.base.db.repo.BlockingRepository;
|
||||
import com.axelor.apps.base.db.repo.CurrencyRepository;
|
||||
import com.axelor.apps.base.db.repo.PartnerRepository;
|
||||
@@ -60,7 +59,6 @@ import com.axelor.apps.purchase.service.app.AppPurchaseService;
|
||||
import com.axelor.apps.report.engine.ReportSettings;
|
||||
import com.axelor.auth.AuthUtils;
|
||||
import com.axelor.auth.db.User;
|
||||
import com.axelor.db.JPA;
|
||||
import com.axelor.dms.db.DMSFile;
|
||||
import com.axelor.dms.db.repo.DMSFileRepository;
|
||||
import com.axelor.exception.AxelorException;
|
||||
@@ -70,8 +68,6 @@ import com.axelor.inject.Beans;
|
||||
import com.axelor.meta.MetaFiles;
|
||||
import com.axelor.meta.db.MetaFile;
|
||||
import com.axelor.meta.db.repo.MetaAttachmentRepository;
|
||||
import com.axelor.meta.schema.actions.ActionView;
|
||||
import com.axelor.meta.schema.actions.ActionView.ActionViewBuilder;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.persist.Transactional;
|
||||
@@ -590,7 +586,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
purchaseOrder.setValidatedByUser(AuthUtils.getUser());
|
||||
|
||||
purchaseOrder.setSupplierPartner(validateSupplier(purchaseOrder));
|
||||
|
||||
|
||||
updateCostPrice(purchaseOrder);
|
||||
|
||||
if (purchaseOrder.getImportationFolder() != null) {
|
||||
@@ -601,33 +597,28 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void addFareToImportationFolder(PurchaseOrder purchaseOrder,BigDecimal amount) throws AxelorException, MalformedURLException, JSONException {
|
||||
public void addFareToImportationFolder(PurchaseOrder purchaseOrder, BigDecimal amount)
|
||||
throws AxelorException, MalformedURLException, JSONException {
|
||||
|
||||
Product product = Beans.get(ProductRepository.class).find(new Long("8931"));
|
||||
Unit unit = Beans.get(UnitRepository.class).find(new Long("4"));
|
||||
TaxLine taxLine = Beans.get(TaxLineRepository.class).find(new Long("27"));
|
||||
TaxLine taxLine = Beans.get(TaxLineRepository.class).find(new Long("27"));
|
||||
|
||||
PurchaseOrderLine purchaseOrderLine = Beans.get(PurchaseOrderLineService.class)
|
||||
.createPurchaseOrderLine(
|
||||
purchaseOrder,
|
||||
product,
|
||||
product.getName(),
|
||||
"",
|
||||
BigDecimal.ONE,
|
||||
unit
|
||||
);
|
||||
purchaseOrderLine.setPrice(amount);
|
||||
purchaseOrderLine.setPriceDiscounted(amount);
|
||||
purchaseOrderLine.setExTaxTotal(amount);
|
||||
purchaseOrderLine.setInTaxTotal(amount);
|
||||
purchaseOrderLine.setCompanyExTaxTotal(amount);
|
||||
purchaseOrderLine.setCompanyInTaxTotal(amount);
|
||||
purchaseOrderLine.setTaxLine(taxLine);
|
||||
purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLine);
|
||||
PurchaseOrderLine purchaseOrderLine =
|
||||
Beans.get(PurchaseOrderLineService.class)
|
||||
.createPurchaseOrderLine(
|
||||
purchaseOrder, product, product.getName(), "", BigDecimal.ONE, unit);
|
||||
purchaseOrderLine.setPrice(amount);
|
||||
purchaseOrderLine.setPriceDiscounted(amount);
|
||||
purchaseOrderLine.setExTaxTotal(amount);
|
||||
purchaseOrderLine.setInTaxTotal(amount);
|
||||
purchaseOrderLine.setCompanyExTaxTotal(amount);
|
||||
purchaseOrderLine.setCompanyInTaxTotal(amount);
|
||||
purchaseOrderLine.setTaxLine(taxLine);
|
||||
purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLine);
|
||||
|
||||
validatePurchaseOrder(purchaseOrder);
|
||||
validatePurchaseOrder(purchaseOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -130,7 +130,8 @@ public class PurchaseRequestServiceImpl implements PurchaseRequestService {
|
||||
: product.getName(),
|
||||
purchaseRequestLine.getNewProduct() ? null : product.getDescription(),
|
||||
purchaseRequestLine.getQuantity(),
|
||||
purchaseRequestLine.getUnit());
|
||||
purchaseRequestLine.getUnit(),
|
||||
purchaseRequestLine);
|
||||
purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLine);
|
||||
purchaseOrderLineList.add(purchaseOrderLine);
|
||||
purchaseOrderLineService.compute(purchaseOrderLine, purchaseOrder);
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
package com.axelor.apps.purchase.service.print;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.axelor.apps.ReportFactory;
|
||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
||||
import com.axelor.apps.base.service.app.AppBaseService;
|
||||
import com.axelor.apps.purchase.db.ImportationFolder;
|
||||
import com.axelor.apps.purchase.report.IReport;
|
||||
import com.axelor.apps.report.engine.ReportSettings;
|
||||
|
||||
import com.axelor.apps.tool.ModelTool;
|
||||
import com.axelor.apps.tool.ThrowConsumer;
|
||||
import com.axelor.apps.tool.file.PdfTool;
|
||||
@@ -20,9 +13,14 @@ import com.axelor.exception.AxelorException;
|
||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||
import com.axelor.i18n.I18n;
|
||||
import com.axelor.inject.Beans;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImportationFolderPrintService {
|
||||
|
||||
|
||||
public String printCostPriceSheet(ImportationFolder importationFolder, String formatPdf)
|
||||
throws AxelorException {
|
||||
|
||||
@@ -38,7 +36,6 @@ public class ImportationFolderPrintService {
|
||||
ids,
|
||||
new ThrowConsumer<ImportationFolder>() {
|
||||
|
||||
|
||||
public void accept(ImportationFolder importationFolder) throws Exception {
|
||||
importationFolders.add(print(importationFolder, ReportSettings.FORMAT_PDF));
|
||||
}
|
||||
@@ -57,17 +54,14 @@ public class ImportationFolderPrintService {
|
||||
if (importationFolder.getPrintingSettings() == null) {
|
||||
throw new AxelorException(
|
||||
TraceBackRepository.CATEGORY_MISSING_FIELD,
|
||||
String.format(
|
||||
I18n.get(IExceptionMessage.UNIT_CONVERSION_2),
|
||||
importationFolder.getName()),
|
||||
importationFolder);
|
||||
String.format(I18n.get(IExceptionMessage.UNIT_CONVERSION_2), importationFolder.getName()),
|
||||
importationFolder);
|
||||
}
|
||||
String locale = ReportSettings.getPrintingLocale(null);
|
||||
String title = getFileName(importationFolder);
|
||||
ReportSettings reportSetting =
|
||||
ReportFactory.createReport(IReport.COST_PRICE_SHEET, title + " - ${date}");
|
||||
|
||||
|
||||
return reportSetting
|
||||
.addParam("importationFolderId", importationFolder.getId())
|
||||
.addParam("Locale", locale)
|
||||
@@ -83,11 +77,8 @@ public class ImportationFolderPrintService {
|
||||
+ "."
|
||||
+ formatPdf;
|
||||
}
|
||||
|
||||
public String getFileName(ImportationFolder importationFolder) {
|
||||
return I18n.get("Importation folder")
|
||||
+ " "
|
||||
+ importationFolder.getName();
|
||||
}
|
||||
|
||||
public String getFileName(ImportationFolder importationFolder) {
|
||||
return I18n.get("Importation folder") + " " + importationFolder.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,62 @@ public class EmailUtil {
|
||||
|
||||
msg.setSentDate(new Date());
|
||||
|
||||
msg.addRecipient(Message.RecipientType.CC, new InternetAddress(""));
|
||||
|
||||
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail, false));
|
||||
System.out.println("Message is ready");
|
||||
Transport.send(msg);
|
||||
|
||||
System.out.println("EMail Sent Successfully!!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendEmailWithCC(
|
||||
MailAccountService mailAccountService,
|
||||
String toEmail,
|
||||
String subject,
|
||||
String body,
|
||||
String cc1,
|
||||
String cc2) {
|
||||
System.out.println("TLSEmail Start");
|
||||
Properties props = new Properties();
|
||||
|
||||
final String fromEmail = mailAccountService.getDefaultSender().getLogin().toString();
|
||||
final String password = mailAccountService.getDefaultSender().getPassword().toString();
|
||||
props.put("mail.smtp.host", mailAccountService.getDefaultSender().getHost());
|
||||
props.put("mail.smtp.port", mailAccountService.getDefaultSender().getPort());
|
||||
props.put("mail.smtp.auth", "true");
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
|
||||
Authenticator auth =
|
||||
new Authenticator() {
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(fromEmail, password);
|
||||
}
|
||||
};
|
||||
Session session = Session.getInstance(props, auth);
|
||||
try {
|
||||
MimeMessage msg = new MimeMessage(session);
|
||||
// set message headers
|
||||
msg.addHeader("Content-type", "text/HTML; charset=UTF-8");
|
||||
msg.addHeader("format", "flowed");
|
||||
msg.addHeader("Content-Transfer-Encoding", "8bit");
|
||||
|
||||
msg.setFrom(new InternetAddress(fromEmail, "ERP SOPHAL"));
|
||||
|
||||
msg.setReplyTo(InternetAddress.parse(fromEmail, false));
|
||||
|
||||
msg.setSubject(subject, "UTF-8");
|
||||
|
||||
msg.setContent(body, "text/html; charset=utf-8");
|
||||
|
||||
msg.setSentDate(new Date());
|
||||
|
||||
msg.addRecipient(Message.RecipientType.CC, new InternetAddress(cc1));
|
||||
msg.addRecipient(Message.RecipientType.CC, new InternetAddress(cc2));
|
||||
|
||||
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail, false));
|
||||
System.out.println("Message is ready");
|
||||
Transport.send(msg);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ImportationFolderController {
|
||||
|
||||
Beans.get(ImportationFolderServiceImpl.class).calculateSum(purchaseOrders, importationFolder);
|
||||
}
|
||||
|
||||
|
||||
public void calculateAvgPrice(ActionRequest request, ActionResponse response)
|
||||
throws MalformedURLException, JSONException, AxelorException {
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ImportationFolderController {
|
||||
Beans.get(ImportationFolderRepository.class).find(iimportationFolder.getId());
|
||||
List<PurchaseOrderLine> purchaseOrderLines = importationFolder.getPurchaseOrderLineList();
|
||||
|
||||
Beans.get(ImportationFolderServiceImpl.class).calculateAvgPrice(purchaseOrderLines, importationFolder);
|
||||
Beans.get(ImportationFolderServiceImpl.class)
|
||||
.calculateAvgPrice(purchaseOrderLines, importationFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,6 @@ import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
|
||||
import wslite.json.JSONException;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.MalformedURLException;
|
||||
@@ -76,6 +72,7 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import wslite.json.JSONException;
|
||||
|
||||
@Singleton
|
||||
public class PurchaseOrderController {
|
||||
@@ -426,66 +423,67 @@ public class PurchaseOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showFare(ActionRequest request, ActionResponse response) {
|
||||
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
|
||||
purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
|
||||
|
||||
if(purchaseOrder.getImportationType() == 2 ){
|
||||
|
||||
ActionViewBuilder confirmView =
|
||||
ActionView.define("Confirm rejection")
|
||||
.model(Wizard.class.getName())
|
||||
.add("form", "amount-to-pay-fare-form")
|
||||
.param("popup", "true")
|
||||
.param("show-toolbar", "false")
|
||||
.param("show-confirm", "false")
|
||||
.param("popup-save", "false")
|
||||
.param("forceEdit", "true");
|
||||
purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
|
||||
|
||||
confirmView.context("purchaseOrderId", purchaseOrder.getId());
|
||||
response.setView(confirmView.map());
|
||||
}
|
||||
if (purchaseOrder.getImportationType() == 2) {
|
||||
|
||||
ActionViewBuilder confirmView =
|
||||
ActionView.define("Confirm rejection")
|
||||
.model(Wizard.class.getName())
|
||||
.add("form", "amount-to-pay-fare-form")
|
||||
.param("popup", "true")
|
||||
.param("show-toolbar", "false")
|
||||
.param("show-confirm", "false")
|
||||
.param("popup-save", "false")
|
||||
.param("forceEdit", "true");
|
||||
|
||||
confirmView.context("purchaseOrderId", purchaseOrder.getId());
|
||||
response.setView(confirmView.map());
|
||||
}
|
||||
}
|
||||
|
||||
public void validateImportationPurchaseOrder(ActionRequest request, ActionResponse response)
|
||||
throws AxelorException, MalformedURLException, JSONException {
|
||||
|
||||
public void validateImportationPurchaseOrder(ActionRequest request, ActionResponse response) throws AxelorException, MalformedURLException, JSONException {
|
||||
// if (request.getContext().get("val") == null) {
|
||||
// throw new AxelorException(
|
||||
// TraceBackRepository.CATEGORY_MISSING_FIELD,
|
||||
// I18n.get(IExceptionMessage.NO_PURCHASE_ORDER_SELECTED_FOR_PRINTING));
|
||||
// }
|
||||
|
||||
if(request.getContext().get("val") == null){
|
||||
throw new AxelorException(
|
||||
TraceBackRepository.CATEGORY_MISSING_FIELD,
|
||||
I18n.get(IExceptionMessage.NO_PURCHASE_ORDER_SELECTED_FOR_PRINTING));
|
||||
}
|
||||
// BigDecimal val = new BigDecimal(request.getContext().get("val").toString());
|
||||
BigDecimal purchaseOrderId =
|
||||
new BigDecimal(request.getContext().get("purchaseOrderId").toString());
|
||||
|
||||
BigDecimal val = new BigDecimal(request.getContext().get("val").toString());
|
||||
BigDecimal purchaseOrderId = new BigDecimal(request.getContext().get("purchaseOrderId").toString());
|
||||
PurchaseOrder purchaseOrder =
|
||||
Beans.get(PurchaseOrderRepository.class).find(new Long(purchaseOrderId.toString()));
|
||||
|
||||
PurchaseOrder purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(new Long(purchaseOrderId.toString()));
|
||||
|
||||
Beans.get(PurchaseOrderServiceImpl.class).addFareToImportationFolder(purchaseOrder, val);
|
||||
// Beans.get(PurchaseOrderServiceImpl.class).addFareToImportationFolder(purchaseOrder, val);
|
||||
|
||||
ImportationFolder importationFolder =
|
||||
Beans.get(PurchaseOrderServiceImpl.class).generateImportationFolder(purchaseOrder);
|
||||
ImportationFolder importationFolder =
|
||||
Beans.get(PurchaseOrderServiceImpl.class).generateImportationFolder(purchaseOrder);
|
||||
|
||||
// Beans.get(PurchaseOrderRepository.class).save(purchaseOrder);
|
||||
// Beans.get(PurchaseOrderRepository.class).save(purchaseOrder);
|
||||
|
||||
response.setView(
|
||||
ActionView.define("Importation folder")
|
||||
.model(ImportationFolder.class.getName())
|
||||
.add("grid", "importation-folder-grid")
|
||||
.add("form", "importation-folder-form")
|
||||
.param("forceEdit", "true")
|
||||
.domain("self.id = " + importationFolder.getId())
|
||||
.map());
|
||||
|
||||
response.setView(
|
||||
ActionView.define("Importation folder")
|
||||
.model(ImportationFolder.class.getName())
|
||||
.add("grid", "importation-folder-grid")
|
||||
.add("form", "importation-folder-form")
|
||||
.param("forceEdit", "true")
|
||||
.domain("self.id = " + importationFolder.getId())
|
||||
.map());
|
||||
}
|
||||
|
||||
|
||||
public void validateFromFare(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
|
||||
BigDecimal purchaseOrderId = new BigDecimal(request.getContext().get("purchaseOrderId").toString());
|
||||
PurchaseOrder purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(new Long(purchaseOrderId.toString()));
|
||||
|
||||
BigDecimal purchaseOrderId =
|
||||
new BigDecimal(request.getContext().get("purchaseOrderId").toString());
|
||||
PurchaseOrder purchaseOrder =
|
||||
Beans.get(PurchaseOrderRepository.class).find(new Long(purchaseOrderId.toString()));
|
||||
Beans.get(PurchaseOrderService.class).validatePurchaseOrder(purchaseOrder);
|
||||
response.setReload(true);
|
||||
} catch (Exception e) {
|
||||
@@ -493,7 +491,6 @@ public class PurchaseOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cancel(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
|
||||
@@ -699,24 +696,24 @@ public class PurchaseOrderController {
|
||||
Beans.get(PurchaseOrderRepository.class)
|
||||
.find(request.getContext().asType(PurchaseOrder.class).getId());
|
||||
|
||||
// if (purchaseOrder.getImportationType() == 2 && purchaseOrder.getCurrency().getId() != 41){
|
||||
if (purchaseOrder.getCurrency().getId() != 41){
|
||||
|
||||
// ImportationFolder importationFolder =
|
||||
// Beans.get(PurchaseOrderServiceImpl.class).generateImportationFolder(purchaseOrder);
|
||||
ImportationFolder importationFolder =
|
||||
Beans.get(PurchaseOrderServiceImpl.class).generateImportationFolder(purchaseOrder);
|
||||
|
||||
// purchaseOrder.setImportationFolder(importationFolder);
|
||||
purchaseOrder.setImportationFolder(importationFolder);
|
||||
|
||||
// // Beans.get(PurchaseOrderRepository.class).save(purchaseOrder);
|
||||
// Beans.get(PurchaseOrderRepository.class).save(purchaseOrder);
|
||||
|
||||
// response.setView(
|
||||
// ActionView.define("Importation folder")
|
||||
// .model(ImportationFolder.class.getName())
|
||||
// .add("grid", "importation-folder-grid")
|
||||
// .add("form", "importation-folder-form")
|
||||
// .param("forceEdit", "true")
|
||||
// .domain("self.id = " + importationFolder.getId())
|
||||
// .map());
|
||||
// }
|
||||
response.setView(
|
||||
ActionView.define("Importation folder")
|
||||
.model(ImportationFolder.class.getName())
|
||||
.add("grid", "importation-folder-grid")
|
||||
.add("form", "importation-folder-form")
|
||||
.param("forceEdit", "true")
|
||||
.domain("self.id = " + importationFolder.getId())
|
||||
.map());
|
||||
}
|
||||
}
|
||||
|
||||
public void createPurchaseOrderBarCodeSeq(ActionRequest request, ActionResponse response) {
|
||||
|
||||
@@ -119,6 +119,9 @@
|
||||
<many-to-one name="printingSettings" ref="com.axelor.apps.base.db.PrintingSettings"/>
|
||||
<!-- <many-to-one name="invoiceTemplate" ref="com.axelor.apps.account.db.InvoiceTemplate"/> -->
|
||||
|
||||
<decimal name="demurrage" title="Demurrage " scale="6" precision="20" />
|
||||
<decimal name="storageCost" title="Storage cost " scale="6" precision="20" />
|
||||
<decimal name="cx" title="CX " scale="6" precision="20" />
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
|
||||
@@ -1,25 +1,205 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="purchase" package="com.axelor.apps.purchase.db"/>
|
||||
<module name="purchase" package="com.axelor.apps.purchase.db" />
|
||||
|
||||
<entity name="PurchaseOrderLineFile" lang="java">
|
||||
<many-to-one name="coaFile" ref="com.axelor.meta.db.MetaFile" title="coa file" />
|
||||
<string name="noteCOA" large="true" multiline="true" title="Comment on coa"/>
|
||||
<string name="file_type" selection="purchase.importation.folder.file.type" title="File type" />
|
||||
<datetime name="coa_validation_date" title="Coa validation date" />
|
||||
<many-to-one name="coa_validator_user" ref="com.axelor.auth.db.User" />
|
||||
<integer name="statusSelect" title="Status" selection="purchase.order.line.file.status.select" readonly="true"/>
|
||||
<many-to-one name="purchaseOrderLine" ref="com.axelor.apps.purchase.db.PurchaseOrderLine" title="Purchase order" />
|
||||
<string
|
||||
name="noteCOA" large="true" multiline="true" title="Comment on coa" />
|
||||
<string name="file_type"
|
||||
selection="purchase.importation.folder.file.type" title="File type" />
|
||||
<datetime
|
||||
name="coa_validation_date" title="Coa validation date" />
|
||||
<many-to-one
|
||||
name="coa_validator_user" ref="com.axelor.auth.db.User" />
|
||||
|
||||
<integer name="statusSelect"
|
||||
title="Status" selection="purchase.order.line.file.status.select" default="1" readonly="true" />
|
||||
<integer
|
||||
name="rdStatusSelect" title="Status" selection="purchase.order.line.rd.file.status.select"
|
||||
default="1" readonly="true" />
|
||||
<integer name="qaStatusSelect" title="Status"
|
||||
selection="purchase.order.line.qa.file.status.select" default="1" readonly="true" />
|
||||
<integer
|
||||
name="qcStatusSelect" title="Status" selection="purchase.order.line.qc.file.status.select"
|
||||
default="1" readonly="true" />
|
||||
<integer name="productionStatusSelect" title="Status"
|
||||
selection="purchase.order.line.production.file.status.select" default="1" readonly="true" />
|
||||
<integer
|
||||
name="dtStatusSelect" title="Status" selection="purchase.order.line.file.dt.status.select"
|
||||
default="1" readonly="true" />
|
||||
|
||||
<many-to-one name="purchaseOrderLine"
|
||||
ref="com.axelor.apps.purchase.db.PurchaseOrderLine" title="Purchase order" />
|
||||
|
||||
<datetime
|
||||
name="rd_validation_date" title="RD validation date" />
|
||||
<many-to-one name="rd_user"
|
||||
ref="com.axelor.auth.db.User" />
|
||||
|
||||
<datetime name="qa_validation_date" title="QA validation date" />
|
||||
<many-to-one
|
||||
name="qa_validator_user" ref="com.axelor.auth.db.User" />
|
||||
|
||||
<datetime name="qc_validation_date"
|
||||
title="QC validation date" />
|
||||
<many-to-one name="qc_validator_user"
|
||||
ref="com.axelor.auth.db.User" />
|
||||
|
||||
<datetime name="production_validation_date"
|
||||
title="Production validation date" />
|
||||
<many-to-one name="production_validator_user"
|
||||
ref="com.axelor.auth.db.User" />
|
||||
|
||||
<datetime name="dt_validation_date" title="Dt validation date" />
|
||||
<many-to-one
|
||||
name="dt_validator_user" ref="com.axelor.auth.db.User" />
|
||||
|
||||
<datetime name="refusal_date"
|
||||
title="DSC refusal date" />
|
||||
<many-to-one name="refusal_user" ref="com.axelor.auth.db.User" />
|
||||
<string
|
||||
name="refusal_reason" title="Reasons of Refusal" large="true" />
|
||||
|
||||
|
||||
<track>
|
||||
<field name="statusSelect" />
|
||||
<datetime
|
||||
name="rd_refusal_date" title="RD refusal date" />
|
||||
<many-to-one name="rd_refusal_user"
|
||||
ref="com.axelor.auth.db.User" />
|
||||
<string name="rd_refusal_reason" title="Reasons of Refusal"
|
||||
large="true" />
|
||||
|
||||
|
||||
<datetime name="qa_refusal_date" title="QA refusal date" />
|
||||
<many-to-one
|
||||
name="qa_validator_refusal_user" ref="com.axelor.auth.db.User" />
|
||||
<string
|
||||
name="qa_refusal_reason" title="Reasons of Refusal" large="true" />
|
||||
|
||||
|
||||
<datetime
|
||||
name="qc_refusal_date" title="QC refusal date" />
|
||||
<many-to-one name="qc_validator_refusal_user"
|
||||
ref="com.axelor.auth.db.User" />
|
||||
<string name="qc_refusal_reason" title="Reasons of Refusal"
|
||||
large="true" />
|
||||
|
||||
|
||||
<datetime name="production_refusal_date" title="Production refusal date" />
|
||||
<many-to-one
|
||||
name="production_validator_refusal_user" ref="com.axelor.auth.db.User" />
|
||||
<string
|
||||
name="production_refusal_reason" title="Reasons of Refusal" large="true" />
|
||||
|
||||
<datetime
|
||||
name="dt_refusal_date" title="Dr refusal date" />
|
||||
<many-to-one
|
||||
name="dt_validator_refusal_user" ref="com.axelor.auth.db.User" />
|
||||
<string
|
||||
name="dt_refusal_reason" title="Reasons of Refusal" large="true" />
|
||||
|
||||
|
||||
<!-- General Status -->
|
||||
<datetime
|
||||
name="statusReviewDate" title="Status Review Date" />
|
||||
<many-to-one name="statusReviewedBy"
|
||||
ref="com.axelor.auth.db.User" title="Status Reviewed By" />
|
||||
|
||||
<!-- RD -->
|
||||
<datetime name="rdStatusReviewDate"
|
||||
title="RD Status Review Date" />
|
||||
<many-to-one name="rdStatusReviewedBy"
|
||||
ref="com.axelor.auth.db.User" title="RD Status Reviewed By" />
|
||||
|
||||
<!-- QA -->
|
||||
<datetime
|
||||
name="qaStatusReviewDate" title="QA Status Review Date" />
|
||||
<many-to-one
|
||||
name="qaStatusReviewedBy" ref="com.axelor.auth.db.User" title="QA Status Reviewed By" />
|
||||
|
||||
<!-- QC -->
|
||||
<datetime
|
||||
name="qcStatusReviewDate" title="QC Status Review Date" />
|
||||
<many-to-one
|
||||
name="qcStatusReviewedBy" ref="com.axelor.auth.db.User" title="QC Status Reviewed By" />
|
||||
|
||||
<!-- Production -->
|
||||
<datetime
|
||||
name="productionStatusReviewDate" title="Production Status Review Date" />
|
||||
<many-to-one
|
||||
name="productionStatusReviewedBy" ref="com.axelor.auth.db.User"
|
||||
title="Production Status Reviewed By" />
|
||||
|
||||
<!-- DT -->
|
||||
<datetime name="dtStatusReviewDate"
|
||||
title="DT Status Review Date" />
|
||||
<many-to-one name="dtStatusReviewedBy"
|
||||
ref="com.axelor.auth.db.User" title="DT Status Reviewed By" />
|
||||
|
||||
<boolean name="routinePurchase"
|
||||
title="Routine purchase" default="false" />
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
// General Status Constants
|
||||
public static final String STATUS_SELECT = "STATUS_SELECT";
|
||||
|
||||
// RD Status Select Constant
|
||||
public static final String RD_STATUS_SELECT = "RD_STATUS_SELECT";
|
||||
|
||||
// QA Status Select Constant
|
||||
public static final String QA_STATUS_SELECT = "QA_STATUS_SELECT";
|
||||
|
||||
// QC Status Select Constant
|
||||
public static final String QC_STATUS_SELECT = "QC_STATUS_SELECT";
|
||||
|
||||
// Production Status Select Constant
|
||||
public static final String PRODUCTION_STATUS_SELECT = "PRODUCTION_STATUS_SELECT";
|
||||
|
||||
// DT Status Select Constant
|
||||
public static final String DT_STATUS_SELECT = "DT_STATUS_SELECT";
|
||||
]]>
|
||||
</extra-code>
|
||||
|
||||
|
||||
<track>
|
||||
<!-- Status Fields -->
|
||||
<field name="statusSelect" />
|
||||
<field name="rdStatusSelect" />
|
||||
<field name="qaStatusSelect" />
|
||||
<field name="qcStatusSelect" />
|
||||
<field name="productionStatusSelect" />
|
||||
<field name="dtStatusSelect" />
|
||||
|
||||
<!-- Refusal Date Fields -->
|
||||
<field name="refusal_date" />
|
||||
<field name="rd_refusal_date" />
|
||||
<field name="qa_refusal_date" />
|
||||
<field name="qc_refusal_date" />
|
||||
<field name="production_refusal_date" />
|
||||
<field name="dt_refusal_date" />
|
||||
|
||||
<!-- Validation Date Fields -->
|
||||
<field name="coa_validation_date" />
|
||||
<field name="rd_validation_date" />
|
||||
<field name="qa_validation_date" />
|
||||
<field name="qc_validation_date" />
|
||||
<field name="production_validation_date" />
|
||||
<field name="dt_validation_date" />
|
||||
|
||||
<!-- Review Date Fields -->
|
||||
<field name="statusReviewDate" />
|
||||
<field name="rdStatusReviewDate" />
|
||||
<field name="qaStatusReviewDate" />
|
||||
<field name="qcStatusReviewDate" />
|
||||
<field name="productionStatusReviewDate" />
|
||||
<field name="dtStatusReviewDate" />
|
||||
</track>
|
||||
|
||||
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
</domain-models>
|
||||
Reference in New Issue
Block a user