The is not more accidental invalidation in the Odoo ORM, so I switch to computed field for standard price company currency on invoice line. No more inherit of create() and write()
18 lines
559 B
Python
18 lines
559 B
Python
# Copyright 2018-2025 Akretion France (https://www.akretion.com)
|
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class AccountInvoiceReport(models.Model):
|
|
_inherit = 'account.invoice.report'
|
|
|
|
margin = fields.Float(string='Margin', readonly=True)
|
|
|
|
@api.model
|
|
def _select(self):
|
|
select_str = super()._select()
|
|
select_str += ", line.margin_company_currency * currency_table.rate AS margin"
|
|
return select_str
|