sale_report.py 519 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import fields, models
  4. class SaleReport(models.Model):
  5. _inherit = 'sale.report'
  6. margin = fields.Float('Margin')
  7. def _select_additional_fields(self):
  8. res = super()._select_additional_fields()
  9. res['margin'] = f"""SUM(l.margin
  10. / {self._case_value_or_one('s.currency_rate')}
  11. * {self._case_value_or_one('currency_table.rate')})
  12. """
  13. return res