[MERGE] forward port of branch 7.0 up to 284ca73

This commit is contained in:
Denis Ledoux 2014-12-08 14:57:21 +01:00
commit 276d0e76b2
3 changed files with 15 additions and 2 deletions

View File

@ -198,6 +198,7 @@
<field name="name">account.analytic.account.list.contract</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="account.view_account_analytic_account_list"/>
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="arch" type="xml">
<field name="date_start" position="before">
<field name="last_invoice_date"/>

View File

@ -37,7 +37,9 @@ class pad_common(osv.osv_memory):
s = string.ascii_uppercase + string.digits
salt = ''.join([s[random.randint(0, len(s) - 1)] for i in range(10)])
#path
path = '%s-%s-%s' % (cr.dbname.replace('_','-'), self._name, salt)
# etherpad hardcodes pad id length limit to 50
path = '-%s-%s' % (self._name, salt)
path = '%s%s' % (cr.dbname.replace('_','-')[0:50 - len(path)], path)
# contruct the url
url = '%s/p/%s' % (pad["server"], path)

View File

@ -504,7 +504,17 @@ class browse_record(object):
def __getattr__(self, name):
try:
return self[name]
except KeyError, e:
except KeyError as e:
if name in self._all_columns:
raise ValueError(
'Cannot fetch field "%(field)s" for "%(model)s" record '
'with ID %(id)s, that record does not exist or has been '
'deleted' % {
'field': name,
'model': self._model._name,
'id': self._id,
}
)
import sys
exc_info = sys.exc_info()
raise AttributeError, "Got %r while trying to get attribute %s on a %s record." % (e, name, self._table._name), exc_info[2]