如何从odoo的其他字段获取字段的默认值?

时间:2020-05-13 18:21:22

标签: python odoo

在我的模块中,我有一个实体“ Bill”,其中有两个浮点字段“ total”和“ remaining”,我希望“ remaining”从“ total”中获取其默认值。我怎样才能做到这一点? 我已经尝试过这些,但是当我尝试创建一个新的“ Bill”时,它显示错误“ TypeError:float()参数必须是字符串或数字,而不是'Float'“

total = fields.Float(string='Total', digits=(10, 2)) remaining = fields.Float(string='Remaining', digits=(10, 2) default=total)

1 个答案:

答案 0 :(得分:1)

将它们设为def test_verified_user_uses_correct_template(self): user = User.objects.create_superuser('username') self.client.force_login(user) response = self.client.get('/enrolment/') self.assertTemplateUsed(response, 'enrolment/index.html')

Related field