跳至内容
菜单
此问题已终结
1 回复
3465 查看
I have a non-iterable type error. the idea is to read one line of the dps_montant, you can one or more.
I read that you can not go int or float, but I can not find how to do it.
Thank you,

class UMAJournalEvennement(models.Model):
_name = 'uma.debour.prestation'
_description = 'Debour & Prestation et Service Uma'
_rec_name = 'dps_prestation'

template_id = fields.Many2one('uma.template', string="Template UMA")
dps_debour = fields.Char(string="Debour")
dps_montant = fields.Monetary(currency_field='currency_id', string="Montant")
dps_prestation = fields.Char(string="Prestation et Service")
dps_tva = fields.Char(string="TVA")
dps_montant_ht = fields.Monetary(currency_field='currency_id', string="Montant HT")
dps_montant_tva = fields.Monetary(currency_field='currency_id', string="Montant TVA")
dps_montant_ttc = fields.Monetary(currency_field='currency_id', string="Montant TTC")
test_total = fields.Monetary(currency_field='currency_id', string="Montant test", compute="compute_total")
currency_id = fields.Many2one('res.currency')

def compute_total(self):
for rec in self:
rec.test_total = sum(rec.dps_montant)
形象
丢弃
最佳答案

I think you must use de mapped method to get all the values of that field on every record: 
sum(self.mapped('dps_montant'))

形象
丢弃
相关帖文 回复 查看 活动
1
10月 18
3287
3
6月 16
10969
0
10月 15
2910
1
1月 25
876
2
11月 24
1531