diff --git a/account_commission/views/report_settlement_templates.xml b/account_commission/views/report_settlement_templates.xml
index a77b4a5e7..235992eb1 100644
--- a/account_commission/views/report_settlement_templates.xml
+++ b/account_commission/views/report_settlement_templates.xml
@@ -1,21 +1,36 @@
-
-
- Invoice date |
- Invoice |
- Invoice line |
+
+
+
+
Settlement invoice:
+
+
-
-
-
- |
-
-
- |
-
-
- |
+
+
+ Invoice line |
+ Quantity |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+ |
+
diff --git a/commission/models/commission_settlement.py b/commission/models/commission_settlement.py
index d9355165a..6337bb70e 100644
--- a/commission/models/commission_settlement.py
+++ b/commission/models/commission_settlement.py
@@ -10,6 +10,7 @@
class CommissionSettlement(models.Model):
_name = "commission.settlement"
_description = "Settlement"
+ _inherit = ["mail.thread", "mail.activity.mixin"]
name = fields.Char()
total = fields.Float(compute="_compute_total", readonly=True, store=True)
@@ -79,6 +80,12 @@ def _compute_can_edit(self):
def action_cancel(self):
self.write({"state": "cancel"})
+ def _message_auto_subscribe_followers(self, updated_values, subtype_ids):
+ res = super()._message_auto_subscribe_followers(updated_values, subtype_ids)
+ if updated_values.get("agent_id"):
+ res.append((updated_values["agent_id"], subtype_ids, False))
+ return res
+
class SettlementLine(models.Model):
_name = "commission.settlement.line"
diff --git a/commission/reports/report_settlement_templates.xml b/commission/reports/report_settlement_templates.xml
index f11a6955a..e45ea4e05 100644
--- a/commission/reports/report_settlement_templates.xml
+++ b/commission/reports/report_settlement_templates.xml
@@ -1,61 +1,85 @@
+
+
+
+
+
+
+
Settlement
+
+
+
+
+ Date |
+ Commission |
+ Amount settled |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+ Total
+ |
+
+
+ |
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- Commission |
- Amount settled |
-
-
-
-
-
-
- |
-
-
- |
-
-
-
-
-
- Total
- |
-
-
- |
-
-
-
-
-
+
+
diff --git a/commission/tests/test_commission.py b/commission/tests/test_commission.py
index d7f145f2b..e3b573f01 100644
--- a/commission/tests/test_commission.py
+++ b/commission/tests/test_commission.py
@@ -167,3 +167,10 @@ def test_res_partner_agent_propagation(self):
# Write
partner.agent_ids = [(4, self.agent_annual.id)]
self.assertEqual(set(child.agent_ids.ids), set(partner.agent_ids.ids))
+
+ def test_auto_subscribe_agent(self):
+ settlement = self._create_settlement(
+ self.agent_monthly, self.commission_net_paid
+ )
+ # Agent must be in the followers
+ self.assertIn(self.agent_monthly, settlement.message_partner_ids)
diff --git a/commission/views/commission_settlement_views.xml b/commission/views/commission_settlement_views.xml
index 8118c8554..37ff570c7 100644
--- a/commission/views/commission_settlement_views.xml
+++ b/commission/views/commission_settlement_views.xml
@@ -104,6 +104,11 @@
+
+
+
+
+