class test1(models.Model):
"""docstring for ClassName"""
_name = 'test.test1'
_rec_name = 'name'
id = fields.Char(string='ID Test 1', required=True)
name = fields.Char(string='Name ID Test 1', required=True)
price = fields.Float(string='Price ID Test 1', required=True)
class test2(models.Model):
_name = 'test.test2'
test1_name = fields.Many2one("test.test1", "List test 1", required=True)
amount = fields.Integer(string='Amount', required=True, default='1')
mymoney = fields.Float(string="Money", readonly=True)# mymoney = amount * price
@api.onchange("test1_name")
def onchange_test2(self):
#self.mymoney = ????? <============
How to get data "price" from test1 classes for caculate?
Thanks