fixing remove decvices from a temporary lot

This commit is contained in:
Cayo Puigdefabregas 2021-06-09 11:36:11 +02:00
parent 0f744d5eb7
commit c0558733ec
1 changed files with 5 additions and 3 deletions

View File

@ -255,11 +255,13 @@ class LotDeviceView(LotBaseChildrenView):
if lot.trade: if lot.trade:
return delete_from_trade(lot, ids) return delete_from_trade(lot, ids)
if not g.user in lot.owner: # import pdb; pdb.set_trace()
txt = 'This is not your trade' if not g.user == lot.owner:
txt = 'This is not your lot'
raise ma.ValidationError(txt) raise ma.ValidationError(txt)
devices = set(Device.query.filter(Device.id.in_(ids)).filter( devices = set(Device.query.filter(Device.id.in_(ids)).filter(
Device.owner_id.in_(g.user.id))) Device.owner_id == g.user.id))
lot.devices.difference_update(devices) lot.devices.difference_update(devices)