Reviewers: ,
Please review this at http://codereview.tryton.org/928002/
Affected files:
M trytond/modules/account_stock_anglo_saxon/stock.py
M trytond/modules/stock/move.py
Index: trytond/modules/account_stock_anglo_saxon/stock.py
===================================================================
--- a/trytond/modules/account_stock_anglo_saxon/stock.py
+++ b/trytond/modules/account_stock_anglo_saxon/stock.py
@@ -18,6 +18,7 @@
@classmethod
def __setup__(cls):
super(Move, cls).__setup__()
+ cls._check_modify_exclude.add('anglo_saxon_quantity')
cls._sql_constraints += [
('check_anglo_saxon_quantity',
'CHECK(quantity >= anglo_saxon_quantity)',
Index: trytond/modules/stock/move.py
===================================================================
--- a/trytond/modules/stock/move.py
+++ b/trytond/modules/stock/move.py
@@ -100,6 +100,7 @@
@classmethod
def __setup__(cls):
super(Move, cls).__setup__()
+ cls._check_modify_exclude = set()
cls._sql_constraints += [
('check_move_qty_pos',
'CHECK(quantity >= 0.0)', 'Move quantity must be positive'),
@@ -336,11 +337,6 @@
return [(None, '')] + [(m.model, m.name) for m in models]
@classmethod
- def validate(cls, moves):
- super(Move, cls).validate(moves)
- cls.check_period_closed(moves)
-
- @classmethod
def check_period_closed(cls, moves):
Period = Pool().get('stock.period')
periods = Period.search([
@@ -529,6 +525,9 @@
cls.raise_user_error('modify_assigned_done_cancel',
(move.rec_name,))
+ if any(k not in cls._check_modify_exclude for k in vals):
+ cls.check_period_closed(moves)
+
super(Move, cls).write(moves, vals)
for move in moves: