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
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2780
Views
I think you must use de mapped method to get all the values of that field on every record:
sum(self.mapped('dps_montant'))
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Oct 18
|
2712 | ||
|
3
Jun 16
|
10371 | ||
|
0
Oct 15
|
2395 | ||
|
2
Nov 24
|
244 | ||
|
1
Oct 24
|
180 |