se adiciona @fields.on_change para ejecutar funcion cuando se cambian los varoles de algun attributo
FossilOrigin-Name: bee19b201f8c1a6b972c2a9abfe5fb57a558a67be6ecddce4f7f07b5b6980215
This commit is contained in:
@@ -6,3 +6,15 @@ from .virtual import Virtual
|
||||
from .field import Field
|
||||
|
||||
__all__ = [Attribute, Many2One, Model, Virtual, Field]
|
||||
|
||||
def on_change(fields):
|
||||
from functools import wraps
|
||||
|
||||
def decorator(func):
|
||||
setattr(func, 'on_changes', fields)
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(self, *arg, **kwargs):
|
||||
return func(self, *arg, **kwargs)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user