I have a requirement to add an “Item Condition” field to the INItemLotSerial record.
We need this because we offer Rent-To-Own contracts on our portable buildings. When the customer returns a building rather than completing the contract to ownership, we create a return order to ship it back and receive it back into our inventory as a “Used” building.
Since all buildings are manufactured by us, all new records should have the “New” condition. I’ve added the below field to a DAC extension of INItemLotSerial, using the PXDefault attribute to set the value to “New” for new lot serial records. The SWItemCondition.List attribute is a custom string list attribute to provide options for “New” and “Used” conditions.

Now; this value is only changed to used when a return shipment is completed for this item.
I update it using the following code.

This “SetItemCondition()” method is called in an override of the “SOShipmentEntry.updateIN()” method, for return shipments only.
This all works, and if I put a break point right after this in the code, I can query the Database and see that the Item Condition was changed to “Used”.
However, at some point after this, the PXDefault attribute is triggered and the value is changed back to “New”. I know it’s the PXDefault attribute because I can control the behavior by changing the default value in the attribute. If I remove the default, or change the default value to “Used”, a record with the “New” condition will correctly be changed to “Used”.
I will note that the base UpdateIN method is called BEFORE I call the SetItemCondition method, so it’s not the base method that’s setting it back to the default value. Also, we do have additional custom code after the call to SetItemCondition, but it doesn’t touch the itemLotSerial record.
Is there ever a valid case where an existing value should be overridden by the default from the PXDefault attribute? Or, when creating a return shipment, is it possible that the existing INItemLotSerial record is being deleted and copied to a new record during the return process?
Any help is appreciated!