I have added a field (Profit Center) to the Sales Order header and detail tables.
After requiring the field on the header, that field is then used as the default for the corresponding field when the user is adding detail lines to the sales order. This functionality is correctly working for all scenarios EXCEPT for the very first record when the header is unsaved.. Once the header is saved, then upon creating a detail record the field is correctly defaulted. Both fields have the same underlying data and work as intended on their own as selector controls.
Here is what is weird.. When entering a new header and before saving once you add a record in the Document Details grid, the first record does NOT default correctly. If you delete that record and then use the Add Row button, the new record now defaults correctly.
Here is the code for the SO.SOOrder DAC extension:
[PXDBString(20)]
[PXSelector(typeof(Search<ReasonCode.reasonCodeID, Where<ReasonCode.usage, Equal<ReasonCodeUsages.sales>>>), typeof(ReasonCode.reasonCodeID), typeof(ReasonCode.descr))]
[PXUIField(DisplayName="Profit Center")]
Here is the code for the SO.SOLine DAC extension:
[PXDefault(typeof(Search<ReasonCode.reasonCodeID,
Where<ReasonCode.reasonCodeID, Equal<Current<SOOrderExt.usrCostCenter>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]
[PXSelector(typeof(Search<ReasonCode.reasonCodeID, Where<ReasonCode.usage, Equal<ReasonCodeUsages.sales>>>), typeof(ReasonCode.reasonCodeID), typeof(ReasonCode.descr))]
Thanks in advance!
Best answer by mvolshteyn
View original