Use root to update anglo_saxon_quantity

review628002
(transplanted from b3dd5552c16e4c0012a1e5a9d2c0719d123bb137)
This commit is contained in:
Cédric Krier committed 2013-01-13 22:50:22 +01:00
1 parent 94ef54e07d
commit 849b48dc97
1 file changed
+6 -4
+6 -4
View File
@@ -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