Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3293 Weergaven

I try to create filed related with account.invoice.mount_total, and when I do that I get error
My example:

class PlayInvoice(models.Model):
  _name = 'play.invoice'
  
  invoice_id = fields.Many2one('account.invoice', 'Invoice') 
  amount_total_invoice = fields.Monetary(string='Total', related='invoice_id.amount_total')

Error:

Traceback (most recent call last):
    return self._fields[key].__get__(self, type(self))
KeyError: 'currency_id'

Avatar
Annuleer

Try searching for monetary fields in this forum

Beste antwoord

Hi,

Add currency field in your model

 currency_id = fields.Many2one('res.currency', string='Currency', readonly=True},default=invoice_id.currency_id)

currency id set default from invoice.

Thanks

Aswini iWesabe

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jul. 24
2693
1
jun. 24
5153
1
okt. 23
10878
1
okt. 23
98
1
aug. 23
2194