From 849b48dc97efc4c59f7e93e045ade4b18f06d6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 13 Jan 2013 22:50:22 +0100 Subject: [PATCH] Use root to update anglo_saxon_quantity review628002 (transplanted from b3dd5552c16e4c0012a1e5a9d2c0719d123bb137) --- stock.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stock.py b/stock.py index 36b5ad52f1..afcebbde8e 100644 --- a/stock.py +++ b/stock.py @@ -4,6 +4,7 @@ from decimal import Decimal from trytond.model import ModelView, ModelSQL, fields from trytond.pyson import Eval from trytond.pool import Pool +from trytond.transaction import Transaction class Move(ModelSQL, ModelView): @@ -70,10 +71,11 @@ class Move(ModelSQL, ModelView): move_cost_price = move.cost_price cost += move_cost_price * Decimal(str(move_qty)) - self.write(move.id, { - 'anglo_saxon_quantity': ((move.anglo_saxon_quantity or 0.0) - + move_qty), - }) + with Transaction().set_user(0, set_context=True): + self.write(move.id, { + 'anglo_saxon_quantity': ((move.anglo_saxon_quantity or 0.0) + + move_qty), + }) if consumed_qty < total_qty: qty = total_qty - consumed_qty