changeset cdf35272db70 in modules/product_kit:default
details:
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=cdf35272db70
description:
Add batch option to push queue tasks
issue11129
review381661002
diffstat:
account.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (28 lines):
diff -r 0f40f0f40eb2 -r cdf35272db70 account.py
--- a/account.py Sun Mar 06 18:13:01 2022 +0100
+++ b/account.py Wed Mar 09 00:57:17 2022 +0100
@@ -2,6 +2,7 @@
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, Workflow
from trytond.pool import Pool, PoolMeta
+from trytond.transaction import Transaction
class Invoice(metaclass=PoolMeta):
@@ -13,11 +14,15 @@
def post(cls, invoices):
pool = Pool()
Move = pool.get('stock.move')
+ transaction = Transaction()
+ context = transaction.context
super().post(invoices)
moves = sum(
(l.stock_component_moves for i in invoices for l in i.lines), [])
if moves:
- Move.__queue__.update_unit_price(moves)
+ with transaction.set_context(
+ queue_batch=context.get('queue_batch', True)):
+ Move.__queue__.update_unit_price(moves)
class InvoiceLine(metaclass=PoolMeta):