temporary branch
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.axelor.apps.sale.db.repo;
|
||||
|
||||
import com.axelor.apps.base.service.administration.SequenceService;
|
||||
import com.axelor.apps.base.service.app.AppBaseService;
|
||||
import com.axelor.apps.sale.db.SaleOrder;
|
||||
import com.axelor.apps.sale.db.SaleOrderLine;
|
||||
@@ -90,7 +89,7 @@ public class SaleOrderManagementRepository extends SaleOrderRepository {
|
||||
if (Strings.isNullOrEmpty(saleOrder.getSaleOrderSeq()) && !saleOrder.getTemplate()) {
|
||||
if (saleOrder.getStatusSelect() == SaleOrderRepository.STATUS_DRAFT_QUOTATION) {
|
||||
saleOrder.setSaleOrderSeq(
|
||||
Beans.get(SaleOrderWorkflowServiceImpl.class).getSequence(saleOrder.getCompany()));
|
||||
Beans.get(SaleOrderWorkflowServiceImpl.class).getSequence(saleOrder.getCompany()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.axelor.apps.base.service.CurrencyService;
|
||||
import com.axelor.apps.base.service.PriceListService;
|
||||
import com.axelor.apps.base.service.ProductMultipleQtyService;
|
||||
import com.axelor.apps.base.service.app.AppBaseService;
|
||||
import com.axelor.apps.base.service.app.AppService;
|
||||
import com.axelor.apps.base.service.tax.AccountManagementService;
|
||||
import com.axelor.apps.base.service.tax.FiscalPositionService;
|
||||
import com.axelor.apps.sale.db.PackLine;
|
||||
@@ -44,10 +43,6 @@ import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import com.axelor.rpc.Context;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import wslite.json.JSONException;
|
||||
import wslite.json.JSONObject;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -452,8 +447,10 @@ public class SaleOrderLineServiceImpl implements SaleOrderLineService {
|
||||
|
||||
int scale = Beans.get(AppBaseService.class).getNbDecimalDigitForSalePrice();
|
||||
|
||||
return priceListService.computeDiscount(
|
||||
price, saleOrderLine.getDiscountTypeSelect(), saleOrderLine.getDiscountAmount()).setScale(scale);
|
||||
return priceListService
|
||||
.computeDiscount(
|
||||
price, saleOrderLine.getDiscountTypeSelect(), saleOrderLine.getDiscountAmount())
|
||||
.setScale(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -137,15 +137,22 @@ public class SaleOrderWorkflowServiceImpl implements SaleOrderWorkflowService {
|
||||
Beans.get(BlockingService.class)
|
||||
.getBlocking(partner, saleOrder.getCompany(), BlockingRepository.SALE_BLOCKING);
|
||||
|
||||
if (blocking != null) {
|
||||
|
||||
|
||||
if (blocking != null && saleOrder.getInTaxTotal().compareTo(blocking.getMaxAmount()) > 0) {
|
||||
|
||||
System.out.println("************************************");
|
||||
System.out.println(blocking);
|
||||
System.out.println(saleOrder.getInTaxTotal().compareTo(blocking.getMaxAmount()) > 0);
|
||||
System.out.println("************************************");
|
||||
saleOrder.setBlockedOnCustCreditExceed(true);
|
||||
if (!saleOrder.getManualUnblock()) {
|
||||
// if (!saleOrder.getManualUnblock()) {
|
||||
saleOrderRepo.save(saleOrder);
|
||||
String reason =
|
||||
blocking.getBlockingReason() != null ? blocking.getBlockingReason().getName() : "";
|
||||
throw new BlockedSaleOrderException(
|
||||
partner, I18n.get("Client is sale blocked:") + " " + reason);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if (saleOrder.getVersionNumber() == 1
|
||||
|
||||
@@ -93,12 +93,14 @@ public class SaleOrderPrintServiceImpl implements SaleOrderPrintService {
|
||||
|
||||
ReportSettings reportSetting =
|
||||
ReportFactory.createReport(IReport.SALES_ORDER, title + " - ${date}");
|
||||
|
||||
String[] arrOfStr = saleOrder.getInTaxTotal().toString().split("\\.");
|
||||
|
||||
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
||||
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
||||
String number = left+" dinars algériens et "+right+" Cts";
|
||||
String[] arrOfStr = saleOrder.getInTaxTotal().toString().split("\\.");
|
||||
|
||||
String left =
|
||||
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
|
||||
String right =
|
||||
Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
|
||||
String number = left + " dinars algériens et " + right + " Cts";
|
||||
|
||||
return reportSetting
|
||||
.addParam("NumberToWords", number)
|
||||
|
||||
@@ -387,19 +387,26 @@ public class SaleOrderLineController {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException{
|
||||
public void updateQtyUg(ActionRequest request, ActionResponse response) throws AxelorException {
|
||||
Context context = request.getContext();
|
||||
SaleOrderLine saleOrderLine = context.asType(SaleOrderLine.class);
|
||||
|
||||
|
||||
int scale = Beans.get(AppBaseService.class).getNbDecimalDigitForSalePrice();
|
||||
|
||||
BigDecimal qtyUg = saleOrderLine.getProduct().getUg();
|
||||
BigDecimal qty = saleOrderLine.getQty();
|
||||
BigDecimal totalQty = qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4,RoundingMode.HALF_EVEN));
|
||||
BigDecimal totalQty =
|
||||
qty.add(qty.multiply(qtyUg).divide(new BigDecimal(100), 4, RoundingMode.HALF_EVEN));
|
||||
Product product = saleOrderLine.getProduct();
|
||||
if(product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0){
|
||||
BigDecimal ug = saleOrderLine.getProduct().getUg().divide(new BigDecimal(100), scale, RoundingMode.HALF_EVEN);
|
||||
BigDecimal ugAmount = ug.divide(ug.add(BigDecimal.ONE),scale, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100));
|
||||
if (product.getUg() != null && product.getUg().compareTo(BigDecimal.ZERO) > 0) {
|
||||
BigDecimal ug =
|
||||
saleOrderLine
|
||||
.getProduct()
|
||||
.getUg()
|
||||
.divide(new BigDecimal(100), scale, RoundingMode.HALF_EVEN);
|
||||
BigDecimal ugAmount =
|
||||
ug.divide(ug.add(BigDecimal.ONE), scale, RoundingMode.HALF_EVEN)
|
||||
.multiply(new BigDecimal(100));
|
||||
response.setValue("discountTypeSelect", 1);
|
||||
response.setValue("discountAmount", ugAmount);
|
||||
response.setValue("qty", totalQty);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<module name="base" package="com.axelor.apps.base.db"/>
|
||||
|
||||
<entity name="Blocking">
|
||||
<decimal name="maxAmount" title="Total A.T.I." scale="2" precision="20"/>
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
public static final Integer SALE_BLOCKING = 5;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<many-to-one name="saleOrder" ref="com.axelor.apps.sale.db.SaleOrder" title="Sale order"/>
|
||||
<integer name="sequence" title="Seq."/>
|
||||
<many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product"/>
|
||||
<decimal name="intendedQty" title="IntendedQty" default="1"/>
|
||||
<decimal name="qty" title="Qty" default="1"/>
|
||||
<decimal name="oldQty" hidden="true"/>
|
||||
<boolean name="isToPrintLineSubTotal" title="Print subtotal / line"/>
|
||||
|
||||
@@ -386,6 +386,7 @@
|
||||
<field name="attrs" colSpan="12"/>
|
||||
</panel>
|
||||
<panel name="actionsPanel" hideIf="clientPartner == null" sidebar="true" stacked="true">
|
||||
<button name="setDraft" title="Draft" onClick="save,action-sale-order-set-status-draft,save" />
|
||||
<button name="finalizeBtn" title="Finalize" showIf="statusSelect == 1" colSpan="12" onClick="action-group-sale-order-finalize-quotation"/>
|
||||
<button if="(__config__.app.isApp('supplychain') && __config__.app.getApp('supplychain')?.allowCompleteManuallySaleOrder) || (!__config__.app.isApp('supplychain'))" name="completeManuallySaleOrderBtn" title="Complete manually sale order" showIf="statusSelect == 3" prompt="Warning, a completed order can't be changed anymore, do you want to continue?" colSpan="12" onClick="save,action-sale-order-method-complete-sale-order"/>
|
||||
<button if="__config__.app.getApp('sale').getManageSaleOrderVersion()" name="newVersionBtn" title="New version" showIf="statusSelect == 2" colSpan="12" onClick="save,action-sale-record-newVersion,save"/>
|
||||
|
||||
Reference in New Issue
Block a user