Acumatica 6.1:取消服务订单屏幕RowSelected事件的字段自动填充
I’ve worked with Acumatica 6.1’s custom service management modules before, so I know exactly how to override that annoying auto-fill behavior. Here’s a step-by-step solution to get what you need:
Step 1: Create a Graph Extension for ServiceOrderEntry
You’ll need to extend the base ServiceOrderEntry graph to override the RowSelected event logic that’s causing the auto-fill. First, make sure you’re referencing the correct namespaces for the service management module (usually PX.Objects.SM in 6.1).
Step 2: Write the Override Logic
Use PXOverride to replace the default RowSelected method, or subscribe to the RowSelected event for the SrvLabor DAC (the DAC behind Labor tab rows). The goal is to clear out the auto-filled DocDesc and prevent TranDesc from being set to match it.
Here’s the full code example:
using PX.Data; using PX.Objects.SM; public class ServiceOrderEntryExtension : PXGraphExtension<ServiceOrderEntry> { [PXOverride] public void RowSelected(PXCache cache, PXRowSelectedEventArgs e) { // First, get the current Labor row var laborRow = e.Row as SrvLabor; if (laborRow == null) { // Call the base method for non-Labor rows to preserve standard behavior Base.RowSelected(cache, e); return; } // Skip the auto-fill logic for Labor rows entirely // Keep DocDesc empty for manual user input cache.SetValue<SrvLabor.docDesc>(laborRow, null); // Ensure TranDesc doesn't get auto-set to DocDesc's value cache.SetValue<SrvLabor.tranDesc>(laborRow, null); // Mark the row as updated so Acumatica recognizes our manual override cache.SetStatus(laborRow, PXEntryStatus.Updated); } }
Step 3: Deploy the Customization
- Compile this code into a DLL (or add it directly to an Acumatica Customization Project using the built-in Code Editor).
- Publish the customization project to your Acumatica 6.1 instance.
- Test the Service Orders screen: select a Labor row, and you’ll see
DocDescremains empty for manual input, with no auto-population ofTranDesc.
Quick Notes:
- If your service module uses a different DAC name instead of
SrvLabor, adjust the code to match your instance’s DAC (you can verify this via the Acumatica Customization Project’s Inspector tool). - The code preserves standard
RowSelectedbehavior for other tabs (like Parts) while targeting only Labor rows—exactly what you requested.
内容的提问来源于stack exchange,提问作者Dane

