Commits

Jesús Martín (Zikzakmedia) committed 8cb1c7a

Fix DeprecationWarning: on_change argument is deprecated, use the depends decorator

Comments (0)

Files changed (1)

     origin = fields.Function(fields.Reference('Origin', selection='get_origin'),
         'get_origin_value')
     origin_cache = fields.Reference('Origin Cache', selection='get_origin')
-    origin_info = fields.Function(fields.Char('Origin Info',
-            on_change_with=['origin']), 'on_change_with_origin_info')
+    origin_info = fields.Function(fields.Char('Origin Info'),
+        'on_change_with_origin_info')
 
     @classmethod
     def __setup__(cls):
         else:
             return '%s,%s' % (model.name, id_origin)
 
+    @fields.depends('origin')
     def on_change_with_origin_info(self, name=None):
         if self.origin:
             return self.get_origin_name(self.origin)
     origin = fields.Function(fields.Reference('Origin', selection='get_origin'),
         'get_origin_value')
     origin_cache = fields.Reference('Origin Cache', selection='get_origin')
-    origin_info = fields.Function(fields.Char('Origin Info',
-            on_change_with=['origin']), 'on_change_with_origin_info')
+    origin_info = fields.Function(fields.Char('Origin Info'),
+        'on_change_with_origin_info')
     origin_shipment = fields.Many2One('stock.shipment.out', 'Origin Shipment')
 
     @classmethod
         else:
             return '%s,%s' % (model.name, id_origin)
 
+    @fields.depends('origin')
     def on_change_with_origin_info(self, name=None):
         if self.origin:
             return self.get_origin_name(self.origin)