Set default values for fields of button_change decorator
Closes #14120 (grafted from 8210e7db85599228bcdb65019e8cbfab6b913334) --HG-- branch : 6.0
This commit is contained in:
1 parent
50efcbb26a
commit
09b475101e
1 file changed
+8
-1
@@ -15,6 +15,7 @@ from trytond.pool import Pool
|
||||
from trytond.rpc import RPC
|
||||
|
||||
from .fields import on_change_result
|
||||
from .fields.field import _set_value
|
||||
|
||||
__all__ = ['ModelView']
|
||||
|
||||
@@ -822,7 +823,13 @@ class ModelView(Model):
|
||||
func.change = set(fields)
|
||||
if methods:
|
||||
func.change_methods = set(methods)
|
||||
return func
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
for field in fields:
|
||||
_set_value(self, field)
|
||||
return func(self, *args, **kwargs)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
def on_change(self, fieldnames):
|
||||
|
||||
Reference in new issue
Block a user