diff --git a/delivery_usability/__init__.py b/delivery_usability/__init__.py index b857415..3a32260 100644 --- a/delivery_usability/__init__.py +++ b/delivery_usability/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import stock +from . import sale_report diff --git a/delivery_usability/sale_report.py b/delivery_usability/sale_report.py new file mode 100644 index 0000000..ed52635 --- /dev/null +++ b/delivery_usability/sale_report.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2021 Akretion France (http://www.akretion.com) +# @author Alexis de Lattre +# 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