Доброго времени суток!

Может кому-нибудь пригодится.
Сегодня настраивал RLS на InventLocation, в запросе зафиксировал один склад. Далее попытался создать строчку в Заказе - оформить продажу с другого склада, отличного от настроенного в RLS, строчка создается. Аналогично пытаюсь создать в Мягком Чеке, при попытке сохранить - выходит ошибка Склад такой-то не существует. Это при том что выполняется один и тот же код из SalesLine.
Код генерирующий ошибку InventTableModule.checkInventLocationId
X++:
boolean checkInventLocationId(InventLocationId inventLocation, boolean mandatoryCheck = true)
{
boolean ok = true;
if (inventLocation && ! InventLocation::exist(inventLocation))
ok = checkFailed(strFmt("@SYS5001",inventLocation));
..
Причем если я в МЧ пытаюсь пройти этот кусочек отладчиком - ошибки не возникает. Поэтому истинных причин такого различия в поведении мне выяснить не удалось.
Проблему решила доработка
X++:
static boolean exist(InventLocationId _inventLocation)
{
return _inventLocation && InventLocation::find(_inventLocation).RecId;
//return _inventLocation && (select firstonly inventLocation
// index hint InventLocationIdx
// where inventLocation.inventLocationId == _inventLocation
// ).recId != 0;
}
static InventLocation find(InventLocationId _inventLocation, boolean _update = false)
{
InventLocation inventLocation;
;
inventLocation.recordLevelSecurity(true); // drc 9.02.2009
inventLocation.selectForUpdate(_update);
if (_inventLocation)
select firstonly inventLocation
index hint InventLocationIdx
where inventLocation.inventLocationId == _inventLocation;
return inventLocation;
}
Теперь и в заказах и в МЧ при попытке создать строчку с другим складом (отличным от настроенного в RLS) выходит сообщение что склад не существует. Что и требовалось.