Check for no move when changing product template
issue10255 review345781002
This commit is contained in:
1 parent
9de056604d
commit
0562d880c8
1 file changed
+14
+14
@@ -65,6 +65,20 @@ def check_no_move(func):
|
||||
raise AccessError(gettext(msg))
|
||||
# No moves for those records
|
||||
break
|
||||
|
||||
if not values.get('template'):
|
||||
continue
|
||||
template = Template(values['template'])
|
||||
for record in records:
|
||||
for field, msg in Template._modify_no_move:
|
||||
if isinstance(
|
||||
getattr(Template, field), fields.Function):
|
||||
continue
|
||||
if getattr(record, field) != getattr(template, field):
|
||||
if find_moves(cls, [record]):
|
||||
raise AccessError(gettext(msg))
|
||||
# No moves for this record
|
||||
break
|
||||
func(cls, *args)
|
||||
return decorator
|
||||
|
||||
|
||||
Reference in new issue
Block a user