Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Mass mailing on sale orders

Entity: mailing.mailing

Compute Method: _compute_sale_quotation_count

Inputs Method Outputs
  • source_id
  • source_id.ids
  • source_id.id
quotation_data = self.env['sale.order'].sudo()._read_group(
            [('source_id', 'in', self.source_id.ids), ('order_line', '!=', False)],
            ['source_id'], ['__count'],
        )
mapped_data = {source.id: count for source, count in quotation_data}
for mass_mailing in self:
            mass_mailing.sale_quotation_count = mapped_data.get(mass_mailing.source_id.id, 0)

Back to entity