Благодарю! Удалось выбросить пару строчек:
X++:
public static void setStopped(
InventItemOrderSetupMap _inventItemOrderSetupMap,
ItemStopped _stopped,
date _effectiveDate = systemDateGet())
{
InventItemSetupStopped record;
ttsBegin;
record = InventItemSetupStopped::find(_inventItemOrderSetupMap.TableId, _inventItemOrderSetupMap.RecId, _effectiveDate);
record.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
if (record && record.Stopped != _stopped)
{
while select forUpdate validTimeState(_effectiveDate) record
where record.InventItemSetupRecId == _inventItemOrderSetupMap.RecId
&& record.InventItemSetupTableId == _inventItemOrderSetupMap.TableId
{
record.ValidTo = max(_effectiveDate-1, record.ValidFrom);
if (record.validateWrite())
record.update();
}
}
select forUpdate validTimeState(_effectiveDate) record
where record.InventItemSetupRecId == _inventItemOrderSetupMap.RecId
&& record.InventItemSetupTableId == _inventItemOrderSetupMap.TableId;
record.initFromInventItemOrderSetupMap(_inventItemOrderSetupMap);
record.ValidFrom = _effectiveDate;
record.ValidTo = dateMax();
record.Stopped = _stopped;
if (record.validateWrite())
record.write();
ttsCommit;
}
Таблица
...Stopped - моя.
Без строки
record.ValidTo = max(_effectiveDate-1, record.ValidFrom); работает, но ожидаемо перестает формироваться строчка с историей, а хочется.