diff --git a/sale_commission/README.rst b/sale_commission/README.rst
index 3eaef6879..fe6b8b914 100644
--- a/sale_commission/README.rst
+++ b/sale_commission/README.rst
@@ -2,7 +2,7 @@
Sales commissions
=================
-..
+..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
@@ -96,6 +96,10 @@ For adding new agents:
You will also be able to see the settlements that have been made to this
agent from this page.
+
+To show the partner in settlement lines:
+
+
Usage
=====
@@ -229,7 +233,7 @@ promote its widespread use.
Current `maintainer `__:
-|maintainer-pedrobaeza|
+|maintainer-pedrobaeza|
This module is part of the `OCA/commission `_ project on GitHub.
diff --git a/sale_commission/models/settlement.py b/sale_commission/models/settlement.py
index adcb0d94d..e6e07b948 100644
--- a/sale_commission/models/settlement.py
+++ b/sale_commission/models/settlement.py
@@ -30,6 +30,12 @@ def _default_currency(self):
string="Settlement lines",
readonly=True,
)
+ showable_line_ids = fields.One2many(
+ "sale.commission.settlement.line",
+ inverse_name="settlement_id",
+ readonly=True,
+ compute="_compute_total",
+ )
state = fields.Selection(
selection=[
("settled", "Settled"),
@@ -61,10 +67,18 @@ def _default_currency(self):
default=lambda self: self.env.user.company_id,
required=True,
)
+ show_partner_settlement_report = fields.Boolean(
+ related="company_id.show_partner_settlement_report",
+ )
@api.depends("line_ids", "line_ids.settled_amount")
def _compute_total(self):
for record in self:
+ record.showable_line_ids = record.line_ids
+ if record.company_id.settlement_skip_zero_amount_lines:
+ record.showable_line_ids = record.showable_line_ids.filtered(
+ lambda l: l.settled_amount
+ )
record.total = sum(record.mapped("line_ids.settled_amount"))
@api.depends("invoice_line_ids")
@@ -198,6 +212,13 @@ class SettlementLine(models.Model):
related="agent_line.object_id",
string="Source invoice line",
)
+ partner_id = fields.Many2one(
+ "res.partner",
+ related="invoice_line_id.partner_id",
+ )
+ show_partner_settlement_report = fields.Boolean(
+ related="company_id.show_partner_settlement_report",
+ )
agent_id = fields.Many2one(
comodel_name="res.partner",
readonly=True,
diff --git a/sale_commission/static/description/index.html b/sale_commission/static/description/index.html
index 1232f1fe3..301780e8e 100644
--- a/sale_commission/static/description/index.html
+++ b/sale_commission/static/description/index.html
@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }
-pre.code .ln { color: grey; } /* line numbers */
+pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
span.pre {
white-space: pre }
-span.problematic {
+span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -450,6 +451,24 @@
agent from this page.
+To show the partner in settlement lines:
+
+- Go to Settings > Sales > Quotations & Orders:
+
+
+
+- enable the setting “Show partner details in settlements report”
+
+
+To hide lines with amount equals to 0:
+
+- Go to Settings > Sales > Quotations & Orders:
+
+
+
+- enable the setting “Skip lines in settlements with zero amount”
+
+
@@ -567,7 +586,9 @@
This module is maintained by the OCA.
-
+
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
diff --git a/sale_commission/views/report_settlement_templates.xml b/sale_commission/views/report_settlement_templates.xml
index 57e4d47d6..82a526db1 100644
--- a/sale_commission/views/report_settlement_templates.xml
+++ b/sale_commission/views/report_settlement_templates.xml
@@ -6,15 +6,15 @@
-
+
-
+
-
+
@@ -23,7 +23,6 @@
Invoice date |
- Invoice |
Invoice line |
Commission |
Amount settled |
@@ -34,9 +33,6 @@
|
-
-
- |
|