@@ -866,11 +857,8 @@
-
-
@@ -897,7 +885,7 @@
-
+
@@ -968,7 +956,7 @@
type="action" class="oe_stat_button">
-
diff --git a/addons/mass_mailing/views/mass_mailing_views_menus.xml b/addons/mass_mailing/views/mass_mailing_views_menus.xml
new file mode 100644
index 00000000000..57832e6850a
--- /dev/null
+++ b/addons/mass_mailing/views/mass_mailing_views_menus.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/mass_mailing/views/res_config_settings_views.xml b/addons/mass_mailing/views/res_config_settings_views.xml
index 38600acbec9..a8a56b27461 100644
--- a/addons/mass_mailing/views/res_config_settings_views.xml
+++ b/addons/mass_mailing/views/res_config_settings_views.xml
@@ -74,8 +74,6 @@
{'module' : 'mass_mailing'}
-
+ parent="mass_mailing_configuration" sequence="0" action="action_mass_mailing_configuration" groups="base.group_system"/>
diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml
index 91eb4b3f817..aa4e8be7704 100644
--- a/addons/project/views/project_views.xml
+++ b/addons/project/views/project_views.xml
@@ -28,6 +28,8 @@
+
+
diff --git a/addons/utm/__init__.py b/addons/utm/__init__.py
index a0fdc10fe11..dc5e6b693d1 100644
--- a/addons/utm/__init__.py
+++ b/addons/utm/__init__.py
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
from . import models
diff --git a/addons/utm/__manifest__.py b/addons/utm/__manifest__.py
index 66fb0775f94..ffa06da03bf 100644
--- a/addons/utm/__manifest__.py
+++ b/addons/utm/__manifest__.py
@@ -1,16 +1,18 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
{
'name': 'UTM Trackers',
'category': 'Hidden',
'description': """
-Enable UTM trackers in shared links.
-=====================================================
- """,
+Enable management of UTM trackers: campaign, medium, source.
+""",
'version': '1.0',
'depends': ['base'],
'data': [
+ 'data/utm_data.xml',
+ 'views/utm_views.xml',
'security/ir.model.access.csv',
- 'views/utm.xml',
- 'data/utm_data.xml'
],
'demo': [],
'auto_install': False,
diff --git a/addons/utm/models/__init__.py b/addons/utm/models/__init__.py
index faef4eabef7..6ebdc46b951 100644
--- a/addons/utm/models/__init__.py
+++ b/addons/utm/models/__init__.py
@@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
from . import utm
+from . import utm_mixin
from . import ir_http
diff --git a/addons/utm/models/utm.py b/addons/utm/models/utm.py
index 0627177ffd2..41efca78cf5 100644
--- a/addons/utm/models/utm.py
+++ b/addons/utm/models/utm.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, SUPERUSER_ID
-from odoo.http import request
-from odoo.tools import pycompat
+from odoo import fields, models
class UtmMedium(models.Model):
@@ -29,57 +27,3 @@ class UtmSource(models.Model):
_description = 'UTM Source'
name = fields.Char(string='Source Name', required=True, translate=True)
-
-
-class UtmMixin(models.AbstractModel):
-
- """Mixin class for objects which can be tracked by marketing. """
- _name = 'utm.mixin'
- _description = 'UTM Mixin'
-
- campaign_id = fields.Many2one('utm.campaign', 'Campaign',
- help="This is a name that helps you keep track of your different campaign efforts, e.g. Fall_Drive, Christmas_Special")
- source_id = fields.Many2one('utm.source', 'Source',
- help="This is the source of the link, e.g. Search Engine, another domain, or name of email list")
- medium_id = fields.Many2one('utm.medium', 'Medium',
- help="This is the method of delivery, e.g. Postcard, Email, or Banner Ad", oldname='channel_id')
-
- def tracking_fields(self):
- # This function cannot be overridden in a model which inherit utm.mixin
- # Limitation by the heritage on AbstractModel
- # record_crm_lead.tracking_fields() will call tracking_fields() from module utm.mixin (if not overridden on crm.lead)
- # instead of the overridden method from utm.mixin.
- # To force the call of overridden method, we use self.env['utm.mixin'].tracking_fields() which respects overridden
- # methods of utm.mixin, but will ignore overridden method on crm.lead
- return [
- # ("URL_PARAMETER", "FIELD_NAME_MIXIN", "NAME_IN_COOKIES")
- ('utm_campaign', 'campaign_id', 'odoo_utm_campaign'),
- ('utm_source', 'source_id', 'odoo_utm_source'),
- ('utm_medium', 'medium_id', 'odoo_utm_medium'),
- ]
-
- @api.model
- def default_get(self, fields):
- values = super(UtmMixin, self).default_get(fields)
-
- # We ignore UTM for salemen, except some requests that could be done as superuser_id to bypass access rights.
- if self.env.uid != SUPERUSER_ID and self.env.user.has_group('sales_team.group_sale_salesman'):
- return values
-
- for url_param, field_name, cookie_name in self.env['utm.mixin'].tracking_fields():
- if field_name in fields:
- field = self._fields[field_name]
- value = False
- if request:
- # ir_http dispatch saves the url params in a cookie
- value = request.httprequest.cookies.get(cookie_name)
- # if we receive a string for a many2one, we search/create the id
- if field.type == 'many2one' and isinstance(value, pycompat.string_types) and value:
- Model = self.env[field.comodel_name]
- records = Model.search([('name', '=', value)], limit=1)
- if not records:
- records = Model.create({'name': value})
- value = records.id
- if value:
- values[field_name] = value
- return values
diff --git a/addons/utm/models/utm_mixin.py b/addons/utm/models/utm_mixin.py
new file mode 100644
index 00000000000..c239501c972
--- /dev/null
+++ b/addons/utm/models/utm_mixin.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, fields, models, SUPERUSER_ID
+from odoo.http import request
+from odoo.tools import pycompat
+
+
+class UtmMixin(models.AbstractModel):
+ """ Mixin class for objects which can be tracked by marketing. """
+ _name = 'utm.mixin'
+ _description = 'UTM Mixin'
+
+ campaign_id = fields.Many2one('utm.campaign', 'Campaign',
+ help="This is a name that helps you keep track of your different campaign efforts, e.g. Fall_Drive, Christmas_Special")
+ source_id = fields.Many2one('utm.source', 'Source',
+ help="This is the source of the link, e.g. Search Engine, another domain, or name of email list")
+ medium_id = fields.Many2one('utm.medium', 'Medium',
+ help="This is the method of delivery, e.g. Postcard, Email, or Banner Ad", oldname='channel_id')
+
+ @api.model
+ def default_get(self, fields):
+ values = super(UtmMixin, self).default_get(fields)
+
+ # We ignore UTM for salemen, except some requests that could be done as superuser_id to bypass access rights.
+ if self.env.uid != SUPERUSER_ID and self.env.user.has_group('sales_team.group_sale_salesman'):
+ return values
+
+ for url_param, field_name, cookie_name in self.env['utm.mixin'].tracking_fields():
+ if field_name in fields:
+ field = self._fields[field_name]
+ value = False
+ if request:
+ # ir_http dispatch saves the url params in a cookie
+ value = request.httprequest.cookies.get(cookie_name)
+ # if we receive a string for a many2one, we search/create the id
+ if field.type == 'many2one' and isinstance(value, pycompat.string_types) and value:
+ Model = self.env[field.comodel_name]
+ records = Model.search([('name', '=', value)], limit=1)
+ if not records:
+ records = Model.create({'name': value})
+ value = records.id
+ if value:
+ values[field_name] = value
+ return values
+
+ def tracking_fields(self):
+ # This function cannot be overridden in a model which inherit utm.mixin
+ # Limitation by the heritage on AbstractModel
+ # record_crm_lead.tracking_fields() will call tracking_fields() from module utm.mixin (if not overridden on crm.lead)
+ # instead of the overridden method from utm.mixin.
+ # To force the call of overridden method, we use self.env['utm.mixin'].tracking_fields() which respects overridden
+ # methods of utm.mixin, but will ignore overridden method on crm.lead
+ return [
+ # ("URL_PARAMETER", "FIELD_NAME_MIXIN", "NAME_IN_COOKIES")
+ ('utm_campaign', 'campaign_id', 'odoo_utm_campaign'),
+ ('utm_source', 'source_id', 'odoo_utm_source'),
+ ('utm_medium', 'medium_id', 'odoo_utm_medium'),
+ ]
diff --git a/addons/utm/views/utm.xml b/addons/utm/views/utm.xml
deleted file mode 100644
index 6e66bf89103..00000000000
--- a/addons/utm/views/utm.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
- utm.campaign.tree
- utm.campaign
-
-
-
-
-
-
-
-
- utm.campaign.form
- utm.campaign
-
-
-
-
-
-
- Campaigns
- utm.campaign
- form
-
-
-
-
-
-
-
- utm.medium.tree
- utm.medium
-
-
-
-
-
-
-
-
- utm.medium.form
- utm.medium
-
-
-
-
-
- Medium
- utm.medium
- form
- tree,form
-
-