Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3397 Представления
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'))

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
окт. 18
3223
3
июн. 16
10936
0
окт. 15
2864
1
янв. 25
797
2
нояб. 24
1407