The button Add po receipt line stills inactive, but thanks to community members for the suggestion of replacing the projection override with a pxcache extension, now when I release the purchase receipts it creates the bill and adjustment with the Enter AP bill method or by activating the checkbox of create bill.
I am still trying to figure out why the button ADD PO RECEIPT LINE doesn't do anything.
public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
{
public class POReceiptLineAddExt : PXCacheExtension<POReceiptLineAdd>
{
#region UsrTicketSupplier
PXDBString(255, BqlField = typeof(POReceiptLineExt.usrTicketSupplier))]
PXUIField(DisplayName = "Ticket Supplier", Enabled = true)]
public string UsrTicketSupplier { get; set; }
public abstract class usrTicketSupplier : PX.Data.BQL.BqlString.Field<usrTicketSupplier> { }
#endregion
#region UsrTicketCarrier
PXDBString(255, BqlField = typeof(POReceiptLineExt.usrTicketCarrier))]
PXUIField(DisplayName = "Ticket Carrier", Enabled = true)]
public string UsrTicketCarrier { get; set; }
public abstract class usrTicketCarrier : PX.Data.BQL.BqlString.Field<usrTicketCarrier> { }
#endregion
}
//Events for the Dialog ADD PO RECEIPT LINE
public PXSelect<POReceiptLineAdd> POReceiptcheck;
protected virtual void _(Events.RowSelected<POReceiptLineAdd> e)
{
if (e.Row == null) return;
POReceiptLineAdd row = e.Row;
POReceiptLine receiptLine = PXSelect<POReceiptLine,
Where<POReceiptLine.receiptNbr, Equal<Required<POReceiptLine.receiptNbr>>,
And<POReceiptLine.lineNbr, Equal<Required<POReceiptLine.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.LineNbr);
if (receiptLine != null)
{
row.GetExtension<POReceiptLineAddExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketSupplier;
row.GetExtension<POReceiptLineAddExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketCarrier;
}
}
protected virtual void _(Events.RowPersisting<APTran> e)
{
if (e.Row == null) return;
APTran row = e.Row;
if (row.ReceiptNbr != null && row.ReceiptLineNbr != null)
{
POReceiptLineAdd receiptLine = PXSelect<POReceiptLineAdd,
Where<POReceiptLineAdd.receiptNbr, Equal<Required<POReceiptLineAdd.receiptNbr>>,
And<POReceiptLineAdd.lineNbr, Equal<Required<POReceiptLineAdd.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.ReceiptLineNbr);
if (receiptLine != null)
{
row.GetExtension<APTranExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineAddExt>().UsrTicketSupplier;
row.GetExtension<APTranExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineAddExt>().UsrTicketCarrier;
}
}
}
//Event for ENTER AP BILL
protected virtual void _(Events.RowInserting<APTran> e)
{
if (e.Row == null) return;
APTran row = e.Row;
if (row.ReceiptNbr != null && row.ReceiptLineNbr != null)
{
POReceiptLine receiptLine = PXSelect<POReceiptLine,
Where<POReceiptLine.receiptNbr, Equal<Required<POReceiptLine.receiptNbr>>,
And<POReceiptLine.lineNbr, Equal<Required<POReceiptLine.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.ReceiptLineNbr);
if (receiptLine != null)
{
row.GetExtension<APTranExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketSupplier;
row.GetExtension<APTranExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketCarrier;
}
}
}
}
The button Add po receipt line stills inactive, but thanks to community members for the suggestion of replacing the projection override with a pxcache extension, now when I release the purchase receipts it creates the bill and adjustment with the Enter AP bill method or by activating the checkbox of create bill.
I am still trying to figure out why the button ADD PO RECEIPT LINE doesn't do anything.
public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
{
public class POReceiptLineAddExt : PXCacheExtension<POReceiptLineAdd>
{
#region UsrTicketSupplier
PXDBString(255, BqlField = typeof(POReceiptLineExt.usrTicketSupplier))]
PXUIField(DisplayName = "Ticket Supplier", Enabled = true)]
public string UsrTicketSupplier { get; set; }
public abstract class usrTicketSupplier : PX.Data.BQL.BqlString.Field<usrTicketSupplier> { }
#endregion
#region UsrTicketCarrier
PXDBString(255, BqlField = typeof(POReceiptLineExt.usrTicketCarrier))]
PXUIField(DisplayName = "Ticket Carrier", Enabled = true)]
public string UsrTicketCarrier { get; set; }
public abstract class usrTicketCarrier : PX.Data.BQL.BqlString.Field<usrTicketCarrier> { }
#endregion
}
//Events for the Dialog ADD PO RECEIPT LINE
public PXSelect<POReceiptLineAdd> POReceiptcheck;
protected virtual void _(Events.RowSelected<POReceiptLineAdd> e)
{
if (e.Row == null) return;
POReceiptLineAdd row = e.Row;
POReceiptLine receiptLine = PXSelect<POReceiptLine,
Where<POReceiptLine.receiptNbr, Equal<Required<POReceiptLine.receiptNbr>>,
And<POReceiptLine.lineNbr, Equal<Required<POReceiptLine.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.LineNbr);
if (receiptLine != null)
{
row.GetExtension<POReceiptLineAddExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketSupplier;
row.GetExtension<POReceiptLineAddExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketCarrier;
}
}
protected virtual void _(Events.RowPersisting<APTran> e)
{
if (e.Row == null) return;
APTran row = e.Row;
if (row.ReceiptNbr != null && row.ReceiptLineNbr != null)
{
POReceiptLineAdd receiptLine = PXSelect<POReceiptLineAdd,
Where<POReceiptLineAdd.receiptNbr, Equal<Required<POReceiptLineAdd.receiptNbr>>,
And<POReceiptLineAdd.lineNbr, Equal<Required<POReceiptLineAdd.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.ReceiptLineNbr);
if (receiptLine != null)
{
row.GetExtension<APTranExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineAddExt>().UsrTicketSupplier;
row.GetExtension<APTranExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineAddExt>().UsrTicketCarrier;
}
}
}
//Event for ENTER AP BILL
protected virtual void _(Events.RowInserting<APTran> e)
{
if (e.Row == null) return;
APTran row = e.Row;
if (row.ReceiptNbr != null && row.ReceiptLineNbr != null)
{
POReceiptLine receiptLine = PXSelect<POReceiptLine,
Where<POReceiptLine.receiptNbr, Equal<Required<POReceiptLine.receiptNbr>>,
And<POReceiptLine.lineNbr, Equal<Required<POReceiptLine.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.ReceiptLineNbr);
if (receiptLine != null)
{
row.GetExtension<APTranExt>().UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketSupplier;
row.GetExtension<APTranExt>().UsrTicketCarrier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketCarrier;
}
}
}
}
I figured it out, my mistake was that after I changed the projection override to the pxcache extension, I didn't need the view public PXSelect<POReceiptLineAdd> POReceiptcheck; anymore, I just had to replace POReceiptcheck to the original view and it worked.
Hi @orlandonegron43 , Add PO Receipt Line is enabled / disabled in a RowSelected event in AddPOReceiptLineExtension. You need to review / debug this part to see why it is disabled.
bool allowAddReceiptLine = invoiceState.IsDocumentEditable &&
invoiceState.AllowAddPOByProject &&
!invoiceState.IsDocumentScheduled &&
Base.vendor.Current != null &&
!invoiceState.IsRetainageDebAdj;
addReceiptLine.SetEnabled(allowAddReceiptLine);
I would also try to unpublish this customization project to see if the button is enabled or not.