add trade action iun devices when this device is insert in a lot with a trade
This commit is contained in:
parent
a2b074e707
commit
b72f9f37c6
|
@ -55,6 +55,12 @@ class LotDeviceForm(FlaskForm):
|
||||||
return bool(self._devices)
|
return bool(self._devices)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
trade = self._lot.trade
|
||||||
|
if trade:
|
||||||
|
for dev in self._devices:
|
||||||
|
if not trade in dev.actions:
|
||||||
|
trade.devices.add(dev)
|
||||||
|
|
||||||
self._lot.devices.update(self._devices)
|
self._lot.devices.update(self._devices)
|
||||||
db.session.add(self._lot)
|
db.session.add(self._lot)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
Reference in a new issue