[MERGE] merge bzr saas-4 server branch

This commit is contained in:
Christophe Simonis 2014-05-20 17:05:25 +02:00
commit 8f0066d728
3 changed files with 20 additions and 1 deletions

View File

@ -801,7 +801,8 @@ class DurationConverter(osv.AbstractModel):
v*secs_per_unit, threshold=1, locale=locale)
if section:
sections.append(section)
return u' '.join(sections)
return ' '.join(sections)
class RelativeDatetimeConverter(osv.AbstractModel):
_name = 'ir.qweb.field.relative'
@ -846,6 +847,7 @@ class Contact(orm.AbstractModel):
'fax': field_browse.fax,
'city': field_browse.city,
'country_id': field_browse.country_id and field_browse.country_id.name_get()[0][1],
'website': field_browse.website,
'email': field_browse.email,
'fields': opf,
'object': field_browse,

View File

@ -18,6 +18,10 @@
<div t-if="phone and 'phone' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-phone'/> <span itemprop="telephone" t-esc="phone"/></div>
<div t-if="mobile and 'mobile' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-mobile-phone'/> <span itemprop="telephone" t-esc="mobile"/></div>
<div t-if="fax and 'fax' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-file-text-o'/> <span itemprop="faxNumber" t-esc="fax"/></div>
<div t-if="website and 'website' in fields" class='css_editable_mode_hidden'>
<i t-if="not options.get('no_marker')" class='fa fa-globe'/>
<a t-att-href="website"><span itemprop="website" t-esc="website"/></a>
</div>
<div t-if="email and 'email' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-envelope'/> <span itemprop="email" t-esc="email"/></div>
</div>
</address>

View File

@ -23,6 +23,7 @@ import datetime
from lxml import etree
import math
import pytz
import urlparse
import openerp
from openerp import SUPERUSER_ID
@ -507,6 +508,14 @@ class res_partner(osv.osv, format_address):
if not parent.is_company:
parent.write({'is_company': True})
def _clean_website(self, website):
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(website)
if not scheme:
if not netloc:
netloc, path = path, ''
website = urlparse.urlunparse(('http', netloc, path, params, query, fragment))
return website
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]
@ -514,6 +523,8 @@ class res_partner(osv.osv, format_address):
#is the same as the company of all users that inherit from this partner
#(this is to allow the code from res_users to write to the partner!) or
#if setting the company_id to False (this is compatible with any user company)
if vals.get('website'):
vals['website'] = self._clean_website(vals['website'])
if vals.get('company_id'):
for partner in self.browse(cr, uid, ids, context=context):
if partner.user_ids:
@ -526,6 +537,8 @@ class res_partner(osv.osv, format_address):
return result
def create(self, cr, uid, vals, context=None):
if vals.get('website'):
vals['website'] = self._clean_website(vals['website'])
new_id = super(res_partner, self).create(cr, uid, vals, context=context)
partner = self.browse(cr, uid, new_id, context=context)
self._fields_sync(cr, uid, partner, vals, context)