Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FW] [14.0] account_payment_sale: add payment_mode_id in sale.report #1352

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_payment_sale/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import sale_order
from . import sale_report
27 changes: 27 additions & 0 deletions account_payment_sale/models/sale_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class SaleReport(models.Model):
_inherit = "sale.report"

payment_mode_id = fields.Many2one(
"account.payment.mode",
string="Payment Mode",
readonly=True,
)

def _query(self, with_clause="", fields=None, groupby="", from_clause=""):
if fields is None:
fields = {}
fields["payment_mode_id"] = ", s.payment_mode_id as payment_mode_id"
groupby += ", s.payment_mode_id"
return super()._query(
with_clause=with_clause,
fields=fields,
groupby=groupby,
from_clause=from_clause,
)
Loading