Add carrier_id in sale.report

This commit is contained in:
Alexis de Lattre
2021-05-25 10:42:41 +02:00
parent 24cc7e1eaa
commit 45bc579e97
2 changed files with 24 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from . import stock
from . import sale_report

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2021 Akretion France (http://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 fields, models
class SaleReport(models.Model):
_inherit = 'sale.report'
carrier_id = fields.Many2one(
"delivery.carrier", string="Delivery Method", readonly=True)
def _select(self):
select_str = super(SaleReport, self)._select()
select_str += ", s.carrier_id as carrier_id"
return select_str
def _group_by(self):
groupby_str = super(SaleReport, self)._group_by()
groupby_str += ", s.carrier_id"
return groupby_str