From 4f92430139bc5386979a7d592d18df784eec37bf Mon Sep 17 00:00:00 2001 From: qmo-odoo Date: Fri, 2 Aug 2019 07:54:57 +0000 Subject: [PATCH] [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 --- addons/mass_mailing_sale/models/mailing_mailing.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/mass_mailing_sale/models/mailing_mailing.py b/addons/mass_mailing_sale/models/mailing_mailing.py index 2a347a3694a..08716037a55 100644 --- a/addons/mass_mailing_sale/models/mailing_mailing.py +++ b/addons/mass_mailing_sale/models/mailing_mailing.py @@ -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