+
| |||||||
+ Powered by Odoo + |
%s
%s
') % ( + helper_header, helper_message, + ), + 'name': _("Sales Analysis"), + 'res_model': 'sale.report', + 'type': 'ir.actions.act_window', + 'view_mode': 'tree,pivot,graph,form', + } + + def action_redirect_to_invoiced(self): + domain = expression.AND([ + [('source_id', '=', self.source_id.id)], + [('state', 'not in', ['draft', 'cancel'])] + ]) + moves = self.env['account.move'].search(domain) + helper_header = _("No Revenues yet!") + helper_message = _("Revenues will appear here once orders are turned into invoices.") + return { + 'context': { + 'create': False, + 'edit': False, + 'view_no_maturity': True, + 'search_default_group_by_invoice_date_week': True, + 'invoice_report_view_hide_invoice_date': True, + }, + 'domain': [('move_id', 'in', moves.ids)], + 'help': Markup('%s
%s
') % ( + helper_header, helper_message, + ), + 'name': _("Invoices Analysis"), + 'res_model': 'account.invoice.report', + 'type': 'ir.actions.act_window', + 'view_mode': 'tree,pivot,graph,form', + } + + def _prepare_statistics_email_values(self): + self.ensure_one() + values = super(MassMailing, self)._prepare_statistics_email_values() + if not self.user_id: + return values + + self_with_company = self.with_company(self.user_id.company_id) + currency = self.user_id.company_id.currency_id + formated_amount = tools.format_decimalized_amount(self_with_company.sale_invoiced_amount, currency) + + values['kpi_data'][1]['kpi_col2'] = { + 'value': self.sale_quotation_count, + 'col_subtitle': _('QUOTATIONS'), + } + values['kpi_data'][1]['kpi_col3'] = { + 'value': formated_amount, + 'col_subtitle': _('INVOICED'), + } + values['kpi_data'][1]['kpi_name'] = 'sale' + return values diff --git a/models/sale_order.py b/models/sale_order.py new file mode 100644 index 0000000..d55aaef --- /dev/null +++ b/models/sale_order.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + _mailing_enabled = True + + def _mailing_get_default_domain(self, mailing): + """ Exclude by default canceled orders when performing a mass mailing. """ + return [('state', '!=', 'cancel')] diff --git a/models/utm.py b/models/utm.py new file mode 100644 index 0000000..661ac26 --- /dev/null +++ b/models/utm.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class UtmCampaign(models.Model): + _inherit = 'utm.campaign' + + ab_testing_winner_selection = fields.Selection(selection_add=[ + ('sale_quotation_count', 'Quotations'), + ('sale_invoiced_amount', 'Revenues'), + ]) diff --git a/views/mailing_mailing_views.xml b/views/mailing_mailing_views.xml new file mode 100644 index 0000000..a5bef86 --- /dev/null +++ b/views/mailing_mailing_views.xml @@ -0,0 +1,26 @@ + +