[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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user