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)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
1
Responder
3633
Vistas
I think you must use de mapped method to get all the values of that field on every record:
sum(self.mapped('dps_montant'))
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
oct 18
|
3595 | ||
|
3
jun 16
|
11102 | ||
|
0
oct 15
|
3137 | ||
|
1
ene 25
|
1165 | ||
|
2
nov 24
|
1836 |