diff options
| author | Jeremy Kersten <jke@odoo.com> | 2015-01-21 13:13:19 +0100 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2015-01-21 13:26:05 +0100 |
| commit | d6533807828273d17c3a814c895cc97a2c21efa8 (patch) | |
| tree | 908d15d2974f90e01b8b4afeacdd27ae658deb1b /addons | |
| parent | 8e9ac21c69dd9c4c3ebedf22e36f0475ce3458d5 (diff) | |
[FIX] website_crm_score: fix bug in salesteam kanban 'ownerDocument' + misc.
Fix kanban:
Move invisible user_id field outside the kanban-box.
Since jQuery migration (1.8 -> 1.11), the function append has not the same behavior.
$([undefined]).append() will crash, so when Odoo whas trying to render the user_ids m2m field in kanban, that crashs.
Anyway, moving the code outside this kanban-box, will avoid to render an invisible m2m_tag.
Misc:
Escape html
concat with %s
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website_crm_score/controllers/main.py | 7 | ||||
| -rw-r--r-- | addons/website_crm_score/models/pageview.py | 10 | ||||
| -rw-r--r-- | addons/website_crm_score/views/sales.xml | 4 |
3 files changed, 13 insertions, 8 deletions
diff --git a/addons/website_crm_score/controllers/main.py b/addons/website_crm_score/controllers/main.py index cc95bec8685..bbb2c6a7c16 100644 --- a/addons/website_crm_score/controllers/main.py +++ b/addons/website_crm_score/controllers/main.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from openerp import addons, http, SUPERUSER_ID, fields from openerp.http import request +from openerp.tools import html_escape class PageController(addons.website.controllers.main.Website): @@ -68,7 +69,6 @@ class ContactController(addons.website_crm.controllers.main.contactus): ('stage_id.probability', '!=', 0), ('stage_id.probability', '!=', 100) ] - domain.extend(['|', ('stage_id.on_change', '=', False), '&', ('stage_id.probability', '!=', 0), ('stage_id.probability', '!=', 100)]) lead_instance = lead_model.search(cr, SUPERUSER_ID, domain, context=context) if lead_instance: @@ -87,7 +87,7 @@ class ContactController(addons.website_crm.controllers.main.contactus): if changed_values: body = 'Other value given for field ' for fieldname in changed_values.keys(): - body += '<br/><b>' + fieldname + '</b>: <b>' + changed_values[fieldname] + '</b>' + body += '<br/><b>%s</b>: <b>%s</b>' % (fieldname, html_escape(changed_values[fieldname])) request.registry['crm.lead'].message_post(cr, SUPERUSER_ID, [lead_id], body=body, subject="Field value changed", context=context) else: @@ -110,7 +110,8 @@ class ContactController(addons.website_crm.controllers.main.contactus): values['score_pageview_ids'] = score_pageview_ids urls = [] for url in url_list: - urls.append('<a href="' + url + '" target="_blank"><b>' + url + '</b></a>') + url_encoded = html_escape(url) + urls.append('<a href="%s" target="_blank"><b>%s</b></a>' % (url_encoded, url_encoded)) body = '<br/>'.join(urls) new_lead_id = self.create_real_lead(request, values, kwargs) diff --git a/addons/website_crm_score/models/pageview.py b/addons/website_crm_score/models/pageview.py index b6ff22ce2da..1aceaa7da96 100644 --- a/addons/website_crm_score/models/pageview.py +++ b/addons/website_crm_score/models/pageview.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from openerp import fields, models, SUPERUSER_ID, tools, api from psycopg2 import IntegrityError +from openerp.tools import html_escape class pageview(models.Model): @@ -14,9 +15,9 @@ class pageview(models.Model): @api.model def create_pageview(self, vals, test=False): # returns True if the operation in the db was successful, False otherwise - lead_id = vals.get('lead_id') - user_id = vals.get('user_id') - url = vals.get('url') + lead_id = vals.get('lead_id', 0) + user_id = vals.get('user_id', 0) + url = vals.get('url', '') view_date = fields.Datetime.now() with self.pool.cursor() as pv_cr: @@ -40,7 +41,8 @@ class pageview(models.Model): fetch = pv_cr.fetchone() if fetch: # a new pageview has been created, a message is posted - body = '<a href="' + url + '" target="_blank"><b>' + url + '</b></a>' + url = html_escape(url) + body = '<a href="%s" target="_blank"><b>%s</b></a>' % (url, url) ctx = dict(self._context, mail_notify_noemail=True) self.pool['crm.lead'].message_post(self._cr, SUPERUSER_ID, [lead_id], body=body, subject="Page visited", context=ctx) return True diff --git a/addons/website_crm_score/views/sales.xml b/addons/website_crm_score/views/sales.xml index 97642a192ca..46e8099e460 100644 --- a/addons/website_crm_score/views/sales.xml +++ b/addons/website_crm_score/views/sales.xml @@ -107,6 +107,9 @@ <field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/> <field name="arch" type="xml"> <data> + <xpath expr="//templates" position="before"> + <field name="user_ids"/> + </xpath> <field name="member_ids" position="after"> <field name="team_user_ids"/> </field> @@ -126,7 +129,6 @@ </xpath> <xpath expr="//div[@class='oe_kanban_salesteams_avatars']" position="replace"> - <field name="user_ids" invisible="True" /> <t t-foreach="record.user_ids.raw_value" t-as="member"> <img t-att-src="kanban_image('res.users', 'image_small', member)" width="32" height="32" /> </t> |
