Skip to content

Commit

Permalink
#2956 delete allowconsolidateinvoice from tests, from old comments
Browse files Browse the repository at this point in the history
* + code cleanup ( mostly deleting old comments)
#2956
  • Loading branch information
metas-rc committed Nov 27, 2017
1 parent ce07c25 commit 0f1195e
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,6 @@ public I_C_Invoice_Candidate splitCandidate(final I_C_Invoice_Candidate ic, fina
aggregationBL.setHeaderAggregationKey(splitCand);
splitCand.setLineAggregationKey(null);
splitCand.setLineAggregationKey_Suffix(ic.getLineAggregationKey_Suffix());
// splitCand.setAllowConsolidateInvoice(ic.isAllowConsolidateInvoice());
splitCand.setDescription(ic.getDescription());

splitCand.setBill_BPartner_ID(ic.getBill_BPartner_ID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ private final void updateInvalid(final I_C_Invoice_Candidate ic)
// update BPartner data from 'ic'
invoiceCandidateHandlerBL.setBPartnerData(ic);

// update the 'QtyInvoiced', 'NetAmtInvoiced', 'Processed' and 'HeaderAggregationKey' values of 'ic'
// task 08512: Note that this call needs to be *after* setBPartnerData() because there we might have updated the AllowConsolidateInvoice flag
invoiceCandBL.set_QtyInvoiced_NetAmtInvoiced_Aggregation0(ctx, ic);

// update C_UOM_ID data from 'ic'
Expand Down Expand Up @@ -337,7 +335,7 @@ private final void updateInvalid(final I_C_Invoice_Candidate ic)
// Save it
invoiceCandDAO.save(ic);
}

/**
* Link all orderLine's inoutLine to our invoice candidate.
*
Expand Down Expand Up @@ -541,7 +539,7 @@ public void onItemError(final Throwable e, final Object item)
// if we discard all changes in this case, then we will have IsError='Y' and also an error message in the IC,
// but the user will probably ignore it, because the IC is still flagged as processed.
invoiceCandBL.setError(ic, e);
//invoiceCandBL.discardChangesAndSetError(ic, e);
// invoiceCandBL.discardChangesAndSetError(ic, e);

invoiceCandDAO.save(ic);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
Expand Down Expand Up @@ -404,14 +404,14 @@ private void configureC_UOM_ID(
locationField.getValueAsInt(),
I_C_BPartner_Location.class,
InterfaceWrapperHelper.getTrxName(product));

final I_M_PriceList_Version currentVersion = priceListBL.getCurrentPriceListVersionOrNull( //
pricingSystem //
, location.getC_Location().getC_Country() // country
, SystemTime.asDayTimestamp() // date
, isSOTrx //
, (Boolean)null // processedPLVFiltering
);
);

productPrice = ProductPrices.retrieveMainProductPriceOrNull(currentVersion, product.getM_Product_ID());
}
Expand Down Expand Up @@ -444,20 +444,15 @@ private void configureC_Tax_ID(final IContextAware contextProvider, final I_M_Pr
final I_M_Warehouse warehouse = null;

priceTaxId = Services.get(ITaxBL.class).getTax(
ctx
, null // no model
, taxCategoryId
, product.getM_Product_ID() // productId
ctx, null // no model
, taxCategoryId, product.getM_Product_ID() // productId
, -1 // chargeId
, date // billDate
, date // shipDate
, product.getAD_Org_ID() // orgId
, warehouse
, locationField.getValueAsInt() // billC_BPartner_Location_ID
, warehouse, locationField.getValueAsInt() // billC_BPartner_Location_ID
, locationField.getValueAsInt() // shipC_BPartner_Location_ID
, isSOTrx
, trxName
);
, isSOTrx, trxName);
}
catch (final ProductPriceNotFoundException ppnfe)
{
Expand Down Expand Up @@ -603,73 +598,6 @@ public void run(final String localTrxName) throws Exception
// Mock (not used, cannot be null)
ic.setRecord_ID(0);

//
// Ignored (commented out / ignored)
//
// ic.setAD_Note(I_AD_Note);
// ic.setAD_Note_ID(int);
// ic.setAD_Org(I_AD_Org);
// ic.setAD_Org_ID(int);
// ic.setAD_Table_ID(int);
// ic.setAD_User_InCharge(I_AD_User);
// ic.setAD_User_InCharge_ID(int);
// ic.setAllowConsolidateInvoice(boolean);
// ic.setBill_User(I_AD_User);
// ic.setBill_User_ID(int);
// ic.setC_Charge(I_C_Charge);
// ic.setC_Charge_ID(int);
// ic.setC_ConversionType(I_C_ConversionType);
// ic.setC_ConversionType_ID(int);
// ic.setC_Invoice_Candidate_Agg(I_C_Invoice_Candidate_Agg);
// ic.setC_Invoice_Candidate_Agg_ID(int);
// ic.setC_Invoice_Candidate_ID(int);
// ic.setC_InvoiceSchedule(I_C_InvoiceSchedule);
// ic.setC_InvoiceSchedule_ID(int);
// ic.setC_Order(I_C_Order);
// ic.setC_Order_ID(int);
// ic.setC_OrderLine(I_C_OrderLine);
// ic.setC_OrderLine_ID(int);
// ic.setDateInvoiced(Timestamp);
// ic.setDateOrdered(Timestamp);
// ic.setDateToInvoice(Timestamp);
// ic.setDateToInvoice_Effective(Timestamp);
// ic.setDateToInvoice_Override(Timestamp);
// ic.setDescription(String);
// ic.setDescriptionBottom(String);
// ic.setDescriptionHeader(String);
// ic.setDiscount_Override(BigDecimal);
// ic.setErrorMsg(String);
// ic.setHeaderAggregationKey(String);
// ic.setInvoiceRule_Effective(String);
// ic.setInvoiceRule_Override(String);
// ic.setInvoiceScheduleAmtStatus(String);
// ic.setIsActive(boolean);
// ic.setIsError(boolean);
// ic.setIsInDispute(boolean);
// ic.setIsManual(boolean);
// ic.setIsToClear(boolean);
// ic.setIsToRecompute(boolean);
// ic.setLineAggregationKey(String);
// ic.setLineAggregationKey_Suffix(String);
// ic.setNetAmtInvoiced(BigDecimal);
// ic.setNetAmtToInvoice(BigDecimal);
// ic.setPriceActual(BigDecimal);
// ic.setPriceActual_Override(BigDecimal);
// ic.setPriceEntered_Override(BigDecimal);
// ic.setProcessed(boolean);
// ic.setQtyDelivered(BigDecimal);
// ic.setQtyInvoiced(BigDecimal);
// ic.setQtyOrderedOverUnder(BigDecimal);
// ic.setQtyToInvoice(BigDecimal);
// ic.setQtyToInvoice_Override(BigDecimal);
// ic.setQtyToInvoice_OverrideFulfilled(BigDecimal);
// ic.setQtyWithIssues(BigDecimal);
// ic.setQualityDiscountPercent(BigDecimal);
// ic.setQualityDiscountPercent_Override(BigDecimal);
// ic.setReasonDiscount(String);
// ic.setSchedulerResult(String);
// ic.setSplitAmt(BigDecimal);

//
// Try save the invoice candidate
InterfaceWrapperHelper.save(ic, localTrxName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,6 @@ private void setBPartnerData(final I_C_Invoice_Candidate ic, final org.compiere.
ic.setBill_Location_ID(order.getBill_Location_ID());
ic.setBill_User_ID(order.getBill_User_ID());

// // 05350 : Set the consolidate invoice flag from the BP
// final IAggregationBL aggregationBL = Services.get(IAggregationBL.class);
// aggregationBL.setAllowConsolidateInvoice(ic);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ protected final C_Invoice_Candidate_Builder createInvoiceCandidate()
// Set defaults (backward compatibility with existing tests)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.setAllowConsolidateInvoiceOnBPartner(true)
.setDiscount(0)
.setC_Tax(tax_Default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ public I_C_Invoice_Candidate build()
ic.setC_Currency(test.currencyConversionBL.getBaseCurrency(ctx));
ic.setDiscount(BigDecimal.valueOf(discount));
ic.setQtyOrdered(qty);
ic.setQtyToInvoice(Env.ZERO); // to be computed
ic.setQtyToInvoice(BigDecimal.ZERO); // to be computed
ic.setQtyToInvoice_Override(null); // no override
ic.setC_ILCandHandler(test.plainHandler);
ic.setIsManual(isManual);
ic.setPriceEntered(BigDecimal.valueOf(priceEntered));
ic.setPriceEntered_Override(priceEntered_Override);
// ic.setAllowConsolidateInvoice(allowConsolidateInvoice);

Check.errorIf(isSOTrx == null, "this builder={} needs isSOTrx to be set before it is able to build an IC", this); // avoid autoboxing-NPE
ic.setIsSOTrx(isSOTrx);
Expand Down Expand Up @@ -335,16 +334,6 @@ public C_Invoice_Candidate_Builder setSOTrx(final boolean isSOTrx)
return this;
}

/**
* Configures the IC's BPartner to use/not use an consolitated header aggregation.
*
* @param allowConsolidateInvoice
*/
public C_Invoice_Candidate_Builder setAllowConsolidateInvoiceOnBPartner(final boolean allowConsolidateInvoice)
{
this.allowConsolidateInvoice = allowConsolidateInvoice;
return this;
}

public C_Invoice_Candidate_Builder setOrderDocNo(final String orderDocNo)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public void testReversal()

final I_C_Invoice_Candidate ic = new C_Invoice_Candidate_Builder(this)
.setSOTrx(true)
.setAllowConsolidateInvoiceOnBPartner(false)
.build();

final BigDecimal invoiceQtyInvoiced = new BigDecimal("10");
Expand Down Expand Up @@ -207,7 +206,6 @@ private void doTestCreditMemoReinvoicableAndReversal(final boolean reverseInvoic

final I_C_Invoice_Candidate ic = new C_Invoice_Candidate_Builder(this)
.setSOTrx(true)
.setAllowConsolidateInvoiceOnBPartner(false)
.build();

final ImmutablePair<I_C_Invoice, I_C_InvoiceLine> invoiceAndLine = creatInvoiceWithOneLine(contextProvider, INVOICE_QTY_INVOICED_TEN, IDocument.STATUS_Completed, invoiceDocTypeBaseName);
Expand Down Expand Up @@ -302,7 +300,6 @@ private void doTest(final boolean isCreditedInvoiceReinvoicable,

final I_C_Invoice_Candidate ic = new C_Invoice_Candidate_Builder(this)
.setSOTrx(true)
.setAllowConsolidateInvoiceOnBPartner(false)
.build();

final ImmutablePair<I_C_Invoice, I_C_InvoiceLine> invoiceAndLine = creatInvoiceWithOneLine(contextProvider, INVOICE_QTY_INVOICED_TEN, IDocument.STATUS_Completed, invoiceDocTypeBaseName);
Expand Down Expand Up @@ -356,6 +353,6 @@ private ImmutablePair<I_C_Invoice, I_C_InvoiceLine> creatInvoiceWithOneLine(
invoiceLine.setQtyInvoiced(creditMemoQtyInvoiced);
invoiceLine.setLine(10);
InterfaceWrapperHelper.save(invoiceLine);
return new ImmutablePair<I_C_Invoice, I_C_InvoiceLine>(invoice, invoiceLine);
return new ImmutablePair<>(invoice, invoiceLine);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void testQtyToInvoice_AfterDelvery()
.setPriceEntered(1)
.setQty(3)
.setSOTrx(false)
.setAllowConsolidateInvoiceOnBPartner(false)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void init()

protected List<IInvoiceLineRW> getInvoiceLines(final IInvoiceHeader invoice)
{
final List<IInvoiceLineRW> result = new ArrayList<IInvoiceLineRW>();
final List<IInvoiceLineRW> result = new ArrayList<>();
for (final IInvoiceCandAggregate lineAgg : invoice.getLines())
{
result.addAll(lineAgg.getAllLines());
Expand All @@ -98,7 +98,7 @@ protected List<IInvoiceLineRW> getInvoiceLines(final IInvoiceHeader invoice)

protected IInvoiceLineRW getInvoiceLineByCandidate(final IInvoiceHeader invoice, final I_C_Invoice_Candidate ic)
{
final List<IInvoiceLineRW> result = new ArrayList<IInvoiceLineRW>();
final List<IInvoiceLineRW> result = new ArrayList<>();
for (final IInvoiceCandAggregate lineAgg : invoice.getLines())
{
result.addAll(lineAgg.getLinesForOrEmpty(ic));
Expand All @@ -119,7 +119,6 @@ else if (result.size() > 1)

protected List<I_C_Invoice_Candidate> test_2StepShipment_CommonSetup_Step01(
final boolean isSOTrx,
final boolean allowConsolidateInvoice,
final BigDecimal priceEntered_Override)
{
return createInvoiceCandidate()
Expand All @@ -131,7 +130,7 @@ protected List<I_C_Invoice_Candidate> test_2StepShipment_CommonSetup_Step01(
.setDiscount(0)
.setManual(false)
.setSOTrx(isSOTrx)
.setAllowConsolidateInvoiceOnBPartner(allowConsolidateInvoice)

.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.buildAsSigletonList();
Expand Down Expand Up @@ -196,7 +195,7 @@ protected IInvoiceHeader removeInvoiceHeaderForInOutId(final List<IInvoiceHeader

protected List<IInvoiceLineRW> getForInOutLine(final List<IInvoiceLineRW> invoiceLines, final I_M_InOutLine iol)
{
final ArrayList<IInvoiceLineRW> result = new ArrayList<IInvoiceLineRW>();
final ArrayList<IInvoiceLineRW> result = new ArrayList<>();
for (final IInvoiceLineRW il : invoiceLines)
{
for (final int icIolId : il.getC_InvoiceCandidate_InOutLine_IDs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
.setQty(50)
.setManual(false)
.setSOTrx(config_IsSOTrx())
.setAllowConsolidateInvoiceOnBPartner(true)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
.setPriceEntered(1)
.setQty(FIFTY.negate())
.setSOTrx(config_IsSOTrx())
.setAllowConsolidateInvoiceOnBPartner(true)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.setInstanceName("ic1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
.setPriceEntered(1)
.setQty(100)
.setSOTrx(false)
.setAllowConsolidateInvoiceOnBPartner(true)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
// Required because QualityDiscountPercent_Override will be applied to the QtyDelivered, and if we have invoiceRule "immediate", then qtyDelivered make a difference at all.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ protected final boolean config_IsSOTrx()
return false;
}

@Override
protected final boolean config_IsAllowConsolidateInvoice()
{
return true;
}

@Override
protected void step_validate_after_aggregation(final List<I_C_Invoice_Candidate> invoiceCandidates, final List<I_M_InOutLine> inOutLines, final List<IInvoiceHeader> invoices)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@
*/
public abstract class AbstractTwoInOutsOneInvoiceSalesTests extends AbstractTwoInOutsTests
{
@Override
protected final boolean config_IsAllowConsolidateInvoice()
{
return true;
}

@Override
protected void step_validate_after_aggregation(final List<I_C_Invoice_Candidate> invoiceCandidates, final List<I_M_InOutLine> inOutLines, final List<IInvoiceHeader> invoices)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ public abstract class AbstractTwoInOutsTests extends AbstractNewAggregationEngin

abstract protected boolean config_IsSOTrx();

abstract protected boolean config_IsAllowConsolidateInvoice();

@Override
protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
{
return test_2StepShipment_CommonSetup_Step01(config_IsSOTrx(), config_IsAllowConsolidateInvoice(), config_GetPriceEntered_Override());
return test_2StepShipment_CommonSetup_Step01(config_IsSOTrx(), config_GetPriceEntered_Override());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@

public abstract class AbstractTwoInOutsTwoInvoicesTests extends AbstractTwoInOutsTests
{
@Override
protected final boolean config_IsAllowConsolidateInvoice()
{
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
.setPriceEntered(1)
.setQty(qtyOrdered)
.setSOTrx(config_IsSOTrx())
.setAllowConsolidateInvoiceOnBPartner(true)
.setOrderDocNo("order1")
.setOrderLineDescription("orderline1_1")
.setInvoiceRule(X_C_Invoice_Candidate.INVOICERULE_NachLieferung)
Expand All @@ -89,7 +88,6 @@ protected List<I_C_Invoice_Candidate> step_createInvoiceCandidates()
.setPriceEntered(1)
.setQty(qtyOrdered)
.setSOTrx(config_IsSOTrx())
.setAllowConsolidateInvoiceOnBPartner(true)
.setOrderDocNo("order2")
.setOrderLineDescription("orderline2_1")
.setInvoiceRule(X_C_Invoice_Candidate.INVOICERULE_NachLieferung)
Expand Down
Loading

0 comments on commit 0f1195e

Please sign in to comment.