Skip to content

Commit

Permalink
EDI support multiple SSCCs per DESADV-Line
Browse files Browse the repository at this point in the history
* don't create DESADVs for non desadv-recipients
#5846

(cherry picked from commit 52a4d9a)
  • Loading branch information
metas-ts committed Dec 17, 2019
1 parent 0ac1784 commit f9938d5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public DesadvBL(@NonNull final HURepository huRepository)
}

@Override
public I_EDI_Desadv addToDesadvCreateForOrderIfNotExist(final I_C_Order order)
public I_EDI_Desadv addToDesadvCreateForOrderIfNotExist(@NonNull final I_C_Order order)
{
Check.assumeNotEmpty(order.getPOReference(), "C_Order {} has a not-empty POReference", order);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class EDIDocumentBL implements IEDIDocumentBL
private static final String ERR_NotExistsShipmentForOrderError = "NotExistsShipmentForOrderError";

@Override
public boolean updateEdiEnabled(final I_EDI_Document_Extension document)
public boolean updateEdiEnabled(@NonNull final I_EDI_Document_Extension document)
{
// EDI applies only for customer invoices and shipments
if (!document.isSOTrx())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public void addToDesadv(final I_C_Order order)
return;
}
final I_C_BPartner bpartner = InterfaceWrapperHelper.create(order.getC_BPartner(), I_C_BPartner.class);
final boolean isEdiRecipient = bpartner.isEdiDesadvRecipient() || bpartner.isEdiInvoicRecipient();
if (!isEdiRecipient)
if (!bpartner.isEdiDesadvRecipient() )
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import de.metas.edi.api.IDesadvBL;
import de.metas.edi.api.IEDIDocumentBL;
import de.metas.edi.model.I_C_BPartner;
import de.metas.edi.model.I_C_Order;
import de.metas.edi.model.I_M_InOut;
import de.metas.handlingunits.inout.IHUInOutBL;
Expand Down Expand Up @@ -64,6 +65,13 @@ private void setEdiEnabledFromOrder(@NonNull final I_M_InOut inout)
return;
}

// order.isEdiEnabled might be for DESADV or INVOIC; so we also need to check the bpartner's flag
final I_C_BPartner bpartner = InterfaceWrapperHelper.create(order.getC_BPartner(), I_C_BPartner.class);
if (!bpartner.isEdiDesadvRecipient())
{
inout.setIsEdiEnabled(false);
}

final boolean isEdiEnabled = order.isEdiEnabled();
inout.setIsEdiEnabled(isEdiEnabled);
}
Expand Down

0 comments on commit f9938d5

Please sign in to comment.