I want to make a divided field BUT why the result is always 0.00 ?
def _get_interest_top(self):
for line in self:
line.interest_top = 6/12
interest_top = fields.Float(compute='_get_interest_top',string='Interest TOP')
The result should be 0.5 right?
CodePudding user response:
From Python doc:
The return type of a division (/) operation depends on its operands. If both operands are of type int, floor division is performed and an int is returned.
So just change one operand to float and you get your desired result.