[FIX] mass_mailing_sale: wrong domain on quotation count

Steps to Reproduce
==================
1). Create an empty quotation and link it to a mass mailing
    (same medium and source).
2). ​Open the mailing form, the stat button displays "1 Quotation"
3). ​Click to open it
-> Empty Screen

Technical
==========
There are no records in this view as it is based on the sales report model.
If a quote has no line, there is nothing to display.

After this commit
=================
Now empty quotes will not be counted.

Task-3635429

closes odoo/odoo#152241

X-original-commit: 05c2859ccebcfc60e27a4833c57f98c2d7944bbb
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
Shaan Thakkar (THSH)
2024-02-01 14:30:05 +00:00
parent 75fab154bb
commit 4d73c391dc
@@ -16,7 +16,7 @@ class MassMailing(models.Model):
@api.depends('mailing_domain')
def _compute_sale_quotation_count(self):
quotation_data = self.env['sale.order'].sudo()._read_group(
[('source_id', 'in', self.source_id.ids)],
[('source_id', 'in', self.source_id.ids), ('order_line', '!=', False)],
['source_id'], ['__count'],
)
mapped_data = {source.id: count for source, count in quotation_data}