Solved

Add PO Receipt Line button Inactive

  • 15 August 2023
  • 3 replies
  • 81 views

Userlevel 2

Good day,

I have 2 custom fields on the purchase receipt line and in Bills and adjustment line, I want those fields in the Dialog of the ADD PO RECEIPT LINE button in the Bills and adjustment screen, retrieve the information and apply it on the Bills and adjustment line.

I can release the purchase receipt, but I can't get the data in the Bills and adjustment.

I have a projection override and my events in a graph extension of the Bills and adjustment screen, to retrieve the information, when my DAC override inherits from POReceiptLineAdd I am having the error Invalid Object Name POReceiptLineS everytime I want to Enter AP Bill. POReceiptLineAdd inherits from POReceiptLineS and when my DAC inherits from it the warning error disappears but the ADD PO RECEIPT LINE button does nothing. 

 

 public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
{
[PXProjection(typeof(Select<POReceiptLineAdd>))]

public partial class POReceiptLineAddOverride : POReceiptLineS
{
#region UsrTicketSupplier
[PXDBString(255)]
[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)]
[PXUIField(DisplayName = "Ticket Carrier", Enabled = true)]

public string UsrTicketCarrier { get; set; }
public abstract class usrTicketCarrier : PX.Data.BQL.BqlString.Field<usrTicketCarrier> { }
#endregion
}

public PXSelect<POReceiptLineAddOverride> POReceiptcheck;

public override void Initialize()
{
base.Initialize();
Base.Views.Caches.Remove(typeof(POReceiptLineAdd));
Base.Views.Caches.Add(typeof(POReceiptLineAddOverride));
}

protected virtual void _(Events.RowSelected<POReceiptLineAddOverride> e)
{
if (e.Row == null) return;

POReceiptLineAddOverride 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.UsrTicketSupplier = receiptLine.GetExtension<POReceiptLineExt>().UsrTicketSupplier;
row.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)
{
POReceiptLineAddOverride receiptLine = PXSelect<POReceiptLineAddOverride,
Where<POReceiptLineAddOverride.receiptNbr, Equal<Required<POReceiptLineAddOverride.receiptNbr>>,
And<POReceiptLineAddOverride.lineNbr, Equal<Required<POReceiptLineAddOverride.lineNbr>>>>>
.Select(Base, row.ReceiptNbr, row.ReceiptLineNbr);

if (receiptLine != null)
{
row.GetExtension<APTranExt>().UsrTicketSupplier = receiptLine.UsrTicketSupplier;
row.GetExtension<APTranExt>().UsrTicketCarrier = receiptLine.UsrTicketCarrier;
}
}
}


}


 

icon

Best answer by orlandonegron43 15 August 2023, 20:20

View original

3 replies

Userlevel 2

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;
}
}
}



}

 

Userlevel 2

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.

Userlevel 6
Badge +3

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.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved