Adding “AllowUpload” to the landed code tab in the

2019-08-04 10:35发布

问题:

I'm trying to add the ability to upload order lines into landed cost on the bills and adjustment screen via excel or csv. I customized the screen and set AllowUpload to True. enter image description here But i don't know how to use the [PXImport]. Can you guy show me step by step.Ex: what is the BQL and where to put it. Be specific. Thanks

回答1:

First determine the name of the DataView bound to the grid. To do that you can hold Ctl-Alt and click on the header of the grid and select Customize. It will open the customization project editor in the Screen section. Click on the top most element of the tree view in the middle to select the grid. Lookup the DataMember property on the property pane on the right side, this is the name of the DataView. While in the project editor, expand the Mode section of the property pane and set AllowUpload property to True.

Now that you know the name of the DataView you need to decorate it with the PXImport attribute. Create a Graph Extension in the code section of the project editor for this screen if you haven't already. In the Graph Extension, for a new DataView that you have created you add [PXImport(typeof(PrimaryDac)] right before the DataView declaration like this:

[PXImport(typeof(APInvoice))]
public PXSelect<MyDAC> MyDataView;

For an existing DataView from the base class you can override it in the same way:

[PXImport(typeof(APInvoice))]
public PXSelect<DAC> BaseDataView;

The Primary DAC can be found in the class declaration of the base graph:

public class APInvoiceEntry : APDataEntryGraph<APInvoiceEntry, APInvoice>, PXImportAttribute.IPXPrepareItems

Reference: Enabling Upload from Excel for the Grid