[MIG] sale_margin_no_onchange from v10 to v12

This commit is contained in:
Alexis de Lattre
2019-08-13 20:52:32 +02:00
parent 7b51c993ec
commit e397f3908e
5 changed files with 35 additions and 34 deletions

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Akretion (http://www.akretion.com)
# Copyright 2018-2019 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -11,7 +10,10 @@ class SaleReport(models.Model):
margin = fields.Float(string='Margin', readonly=True)
def _select(self):
select_str = super(SaleReport, self)._select()
select_str += ", SUM(l.margin_company_currency) AS margin"
return select_str
def _query(self, with_clause='', fields={}, groupby='', from_clause=''):
fields['margin_company_currency'] =\
", SUM(l.margin_company_currency) AS margin"
res = super(SaleReport, self)._query(
with_clause=with_clause, fields=fields, groupby=groupby,
from_clause=from_clause)
return res