[MERGE] merge bzr saas-4 server branch
This commit is contained in:
commit
8f0066d728
|
@ -801,7 +801,8 @@ class DurationConverter(osv.AbstractModel):
|
||||||
v*secs_per_unit, threshold=1, locale=locale)
|
v*secs_per_unit, threshold=1, locale=locale)
|
||||||
if section:
|
if section:
|
||||||
sections.append(section)
|
sections.append(section)
|
||||||
return u' '.join(sections)
|
return ' '.join(sections)
|
||||||
|
|
||||||
|
|
||||||
class RelativeDatetimeConverter(osv.AbstractModel):
|
class RelativeDatetimeConverter(osv.AbstractModel):
|
||||||
_name = 'ir.qweb.field.relative'
|
_name = 'ir.qweb.field.relative'
|
||||||
|
@ -846,6 +847,7 @@ class Contact(orm.AbstractModel):
|
||||||
'fax': field_browse.fax,
|
'fax': field_browse.fax,
|
||||||
'city': field_browse.city,
|
'city': field_browse.city,
|
||||||
'country_id': field_browse.country_id and field_browse.country_id.name_get()[0][1],
|
'country_id': field_browse.country_id and field_browse.country_id.name_get()[0][1],
|
||||||
|
'website': field_browse.website,
|
||||||
'email': field_browse.email,
|
'email': field_browse.email,
|
||||||
'fields': opf,
|
'fields': opf,
|
||||||
'object': field_browse,
|
'object': field_browse,
|
||||||
|
|
|
@ -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="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="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="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 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>
|
</div>
|
||||||
</address>
|
</address>
|
||||||
|
|
|
@ -23,6 +23,7 @@ import datetime
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
import math
|
import math
|
||||||
import pytz
|
import pytz
|
||||||
|
import urlparse
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import SUPERUSER_ID
|
from openerp import SUPERUSER_ID
|
||||||
|
@ -507,6 +508,14 @@ class res_partner(osv.osv, format_address):
|
||||||
if not parent.is_company:
|
if not parent.is_company:
|
||||||
parent.write({'is_company': True})
|
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):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
if isinstance(ids, (int, long)):
|
if isinstance(ids, (int, long)):
|
||||||
ids = [ids]
|
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
|
#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
|
#(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 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'):
|
if vals.get('company_id'):
|
||||||
for partner in self.browse(cr, uid, ids, context=context):
|
for partner in self.browse(cr, uid, ids, context=context):
|
||||||
if partner.user_ids:
|
if partner.user_ids:
|
||||||
|
@ -526,6 +537,8 @@ class res_partner(osv.osv, format_address):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
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)
|
new_id = super(res_partner, self).create(cr, uid, vals, context=context)
|
||||||
partner = self.browse(cr, uid, new_id, context=context)
|
partner = self.browse(cr, uid, new_id, context=context)
|
||||||
self._fields_sync(cr, uid, partner, vals, context)
|
self._fields_sync(cr, uid, partner, vals, context)
|
||||||
|
|
Loading…
Reference in New Issue