[MIG] account_invoice_margin from v14 to v16

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()
This commit is contained in:
Alexis de Lattre
2025-01-16 17:08:37 +01:00
parent 9ff6e15b45
commit e009106e12
4 changed files with 39 additions and 103 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2018-2019 Akretion France (http://www.akretion.com)
# 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).
@@ -10,25 +10,6 @@ class AccountInvoiceReport(models.Model):
margin = fields.Float(string='Margin', readonly=True)
# added margin_company_currency on account.move.line
_depends = {
'account.move': [
'name', 'state', 'move_type', 'partner_id', 'invoice_user_id', 'fiscal_position_id',
'invoice_date', 'invoice_date_due', 'invoice_payment_term_id', 'partner_bank_id',
],
'account.move.line': [
'quantity', 'price_subtotal', 'amount_residual', 'balance', 'amount_currency',
'move_id', 'product_id', 'product_uom_id', 'account_id', 'analytic_account_id',
'journal_id', 'company_id', 'currency_id', 'partner_id',
'margin_company_currency',
],
'product.product': ['product_tmpl_id'],
'product.template': ['categ_id'],
'uom.uom': ['category_id', 'factor', 'name', 'uom_type'],
'res.currency.rate': ['currency_id', 'name'],
'res.partner': ['country_id'],
}
@api.model
def _select(self):
select_str = super()._select()