changeset 230177d16d4a in modules/stock:5.6
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=230177d16d4a
description:
Check for no move when changing product template
issue10255
review345781002
(grafted from 5f85e27900cf58846b64cb6d36eeb78d0d53f88d)
diffstat:
product.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diffs (24 lines):
diff -r 7ba1f9780afe -r 230177d16d4a product.py
--- a/product.py Fri Apr 16 19:13:20 2021 +0200
+++ b/product.py Tue Apr 13 23:47:22 2021 +0200
@@ -62,6 +62,20 @@
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