[FIX] mass_mailing_sale: fix domain for invoiced

PURPOSE

This commit removes the mass_mailing.campaign model. Instead of having a fully
fledged model, we will simply inherit utm.campaign. We will also add relevant
statistics on utm campaign model in order to use it in various applications.

SPECIFICATIONS

This commit fixes the domain used to get the invoiced amount generated
by the mailing.mailing.

The new domain will be the same as the one used in the invoice report

Task ID: 2002029
PR: #34015
This commit is contained in:
qmo-odoo
2019-08-02 12:34:17 +00:00
committed by Thibault Delavallée
parent 682b62f825
commit 4f92430139
@@ -36,17 +36,21 @@ class MassMailing(models.Model):
def action_redirect_to_quotations(self):
action = self.env.ref('sale.action_quotations_with_onboarding').read()[0]
action['domain'] = self._get_sale_utm_domain()
action['context'] = {'default_type': 'lead', 'create': False}
action['context'] = {'create': False}
return action
def action_redirect_to_invoiced(self):
action = self.env.ref('account.view_move_form').read()[0]
action = self.env.ref('account.action_move_journal_line').read()[0]
invoices = self.env['sale.order'].search(self._get_sale_utm_domain()).mapped('invoice_ids')
action['context'] = {
'create': False,
'edit': False,
'view_no_maturity': True
}
action['domain'] = [
('id', 'in', invoices.ids),
('type', 'in', ('out_invoice', 'out_refund')),
('type', '=', 'posted'),
('partner_id', 'child_of', self.id),
('type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')),
('state', 'not in', ['draft', 'cancel'])
]
action['context'] = {'create': False}
return action