mirror of
https://github.com/NaN-tic/trytond-stock_lot_deactivatable.git
synced 2023-12-14 03:22:55 +01:00
Use SQL query to deactivate lot. #048200
This commit is contained in:
parent
f1c8c9fabc
commit
3233a9617a
8
stock.py
8
stock.py
|
@ -64,7 +64,13 @@ class Lot(DeactivableMixin, metaclass=PoolMeta):
|
|||
lots = cls.search(domain)
|
||||
logging.getLogger(cls.__name__).info("Deactivating %s lots", len(lots))
|
||||
if lots:
|
||||
cls.write(lots, {'active': False})
|
||||
# Use SQL update as now the sled date may be required and we want
|
||||
# to be able to deactivate anyway.
|
||||
table = cls.__table__()
|
||||
query = table.update([table.active], [False], where=table.id.in_([
|
||||
x.id for x in lots]))
|
||||
cursor = Transaction().connection.cursor()
|
||||
cursor.execute(*query)
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
|
|
Loading…
Reference in a new issue