Skip to content

Commit 1128361

Browse files
committed
[IMP] sale: add group by UTM source to Invoice Analysis report
This commit: - Adds the `source_id` field (UTM Source) to the `account.invoice.report` model for marketing campaign tracking. - Adds a group by option for UTM Source in the Invoice Analysis report, allowing users to analyze invoice statistics by marketing campaign source. Task : 4950023 closes odoo#219621 Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
1 parent 2c6d6f1 commit 1128361

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

addons/sale/report/account_invoice_report.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ class AccountInvoiceReport(models.Model):
88
_inherit = 'account.invoice.report'
99

1010
team_id = fields.Many2one(comodel_name='crm.team', string="Sales Team")
11+
source_id = fields.Many2one(comodel_name='utm.source', string="Source", readonly=True)
12+
13+
_depends = {
14+
'account.move': ['source_id', 'team_id'],
15+
}
1116

1217
def _select(self) -> SQL:
13-
return SQL("%s, move.team_id as team_id", super()._select())
18+
return SQL("%s, move.source_id, move.team_id as team_id", super()._select())

addons/sale/report/account_invoice_report_views.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<field name="invoice_user_id" position="after">
1313
<field name="team_id"/>
1414
</field>
15+
<filter name="status" position="after">
16+
<filter string="Source" name="source_id" context="{'group_by': 'source_id'}"/>
17+
</filter>
1518
</field>
1619
</record>
1720

0 commit comments

Comments
 (0)