open up invoice in a new page
This commit is contained in:
@@ -49,6 +49,7 @@ import com.axelor.apps.base.service.BankDetailsService;
|
|||||||
import com.axelor.apps.base.service.PartnerPriceListService;
|
import com.axelor.apps.base.service.PartnerPriceListService;
|
||||||
import com.axelor.apps.base.service.PartnerService;
|
import com.axelor.apps.base.service.PartnerService;
|
||||||
import com.axelor.apps.base.service.TradingNameService;
|
import com.axelor.apps.base.service.TradingNameService;
|
||||||
|
import com.axelor.apps.report.engine.ReportSettings;
|
||||||
import com.axelor.apps.tool.StringTool;
|
import com.axelor.apps.tool.StringTool;
|
||||||
import com.axelor.common.ObjectUtils;
|
import com.axelor.common.ObjectUtils;
|
||||||
import com.axelor.db.JPA;
|
import com.axelor.db.JPA;
|
||||||
@@ -355,13 +356,13 @@ public class InvoiceController {
|
|||||||
reportType,
|
reportType,
|
||||||
locale);
|
locale);
|
||||||
title = I18n.get("Invoice");
|
title = I18n.get("Invoice");
|
||||||
response.setCanClose(true);
|
// response.setCanClose(true);
|
||||||
} else {
|
} else {
|
||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
TraceBackRepository.CATEGORY_MISSING_FIELD, I18n.get(IExceptionMessage.INVOICE_3));
|
TraceBackRepository.CATEGORY_MISSING_FIELD, I18n.get(IExceptionMessage.INVOICE_3));
|
||||||
}
|
}
|
||||||
response.setView(ActionView.define(title).add("html", fileLink).map());
|
response.setView(ActionView.define(title).add("html", fileLink).map());
|
||||||
response.setCanClose(true);
|
// response.setCanClose(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TraceBackService.trace(response, e);
|
TraceBackService.trace(response, e);
|
||||||
}
|
}
|
||||||
@@ -1027,9 +1028,6 @@ public class InvoiceController {
|
|||||||
.find(Long.parseLong(context.get("id").toString()));
|
.find(Long.parseLong(context.get("id").toString()));
|
||||||
|
|
||||||
String name = I18n.get("Invoice");
|
String name = I18n.get("Invoice");
|
||||||
String inTaxTotal = invoice.getInTaxTotal().toString();
|
|
||||||
String[] arrOfStr = inTaxTotal.split("\\.");
|
|
||||||
|
|
||||||
|
|
||||||
String format = context.get("format") != null ? context.get("format").toString() : "pdf";
|
String format = context.get("format") != null ? context.get("format").toString() : "pdf";
|
||||||
Integer reportType =
|
Integer reportType =
|
||||||
@@ -1050,26 +1048,11 @@ public class InvoiceController {
|
|||||||
.getCode()
|
.getCode()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
ReportSettings reportSettings = Beans.get(InvoicePrintService.class).prepareReportSettings(invoice, reportType, format, locale);
|
||||||
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
|
||||||
String number = left+" dinars algériens et "+right+" centimes";
|
|
||||||
|
|
||||||
String fileLink =
|
|
||||||
ReportFactory.createReport("invoice.rptdesign", name + "-${date}")
|
|
||||||
.addParam("NumberToWords", number)
|
|
||||||
.addParam("InvoiceId", invoice.getId())
|
|
||||||
.addParam("Locale", locale)
|
|
||||||
.addParam("ReportType", reportType == null ? 0 : reportType)
|
|
||||||
.addParam("HeaderHeight", invoice.getPrintingSettings().getPdfHeaderHeight())
|
|
||||||
.addParam("FooterHeight", invoice.getPrintingSettings().getPdfFooterHeight())
|
|
||||||
.generate()
|
|
||||||
.getFileLink();
|
|
||||||
|
|
||||||
logger.debug("Printing " + name);
|
logger.debug("Printing " + name);
|
||||||
|
|
||||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
response.setView(ActionView.define(name).add("html", reportSettings.generate().getFileLink()).map());
|
||||||
response.setCanClose(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user