如何在 Odoo 11 中获取总浮点值?
How can I get total float values in Odoo 11?
我想得到这两个float字段的总余额。你能帮忙吗?
start_blc = fields.Float("Starting Balance")
end_blc = fields.Float("Ending Balance")
total_blc = fields.Float("Total Balance")
将您的 total_blc 更改为计算字段
total_blc = fields.Float("Total Balance", compute='_compute_total')
@api.depends('end_blc', 'start_blc')
def _compute_total(self):
for record in self:
record.total_blc = record.end_blc + record.start_blc
我想得到这两个float字段的总余额。你能帮忙吗?
start_blc = fields.Float("Starting Balance")
end_blc = fields.Float("Ending Balance")
total_blc = fields.Float("Total Balance")
将您的 total_blc 更改为计算字段
total_blc = fields.Float("Total Balance", compute='_compute_total')
@api.depends('end_blc', 'start_blc')
def _compute_total(self):
for record in self:
record.total_blc = record.end_blc + record.start_blc