bzr revid: fp@tinyerp.com-20090618203311-4srit4hhu3h9hk8p
This commit is contained in:
Fabien Pinckaers 2009-06-18 22:33:11 +02:00
commit 51dd8dff0e
3 changed files with 20 additions and 4 deletions

View File

@ -95,7 +95,7 @@ class ir_attachment(osv.osv):
for i in self.browse(cr, uid, ids, context=context):
result[i.id] = False
for format in ('png','jpg','jpeg','gif','bmp'):
if (i.datas_fname.lower() or '').endswith(format):
if (i.datas_fname and i.datas_fname.lower() or '').endswith(format):
result[i.id]= i.datas
break
return result

View File

@ -2283,9 +2283,16 @@ class orm(orm_template):
# call the 'set' method of fields which are not classic_write
upd_todo.sort(lambda x, y: self._columns[x].priority-self._columns[y].priority)
# default element in context must be remove when call a one2many or many2many
rel_context = context
for c in context.items():
if c[0].startswith('default_'):
del rel_context[c[0]]
for field in upd_todo:
for id in ids:
self._columns[field].set(cr, self, id, field, vals[field], user, context=context)
self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context)
for table in self._inherits:
col = self._inherits[table]
@ -2484,8 +2491,15 @@ class orm(orm_template):
cr.execute('update '+self._table+' set parent_left=parent_left+2 where parent_left>%s', (pleft,))
cr.execute('update '+self._table+' set parent_right=parent_right+2 where parent_right>%s', (pleft,))
cr.execute('update '+self._table+' set parent_left=%s,parent_right=%s where id=%s', (pleft+1,pleft+2,id_new))
# default element in context must be remove when call a one2many or many2many
rel_context = context
for c in context.items():
if c[0].startswith('default_'):
del rel_context[c[0]]
for field in upd_todo:
self._columns[field].set(cr, self, id_new, field, vals[field], user, context)
self._columns[field].set(cr, self, id_new, field, vals[field], user, rel_context)
self._validate(cr, user, [id_new], context)
result = self._store_get_values(cr, user, [id_new], vals.keys(), context)

View File

@ -30,7 +30,7 @@ import re
from reportlab.lib.utils import ImageReader
_regex = re.compile('\[\[(.+?)\]\]')
utils._regex = re.compile('\[\[\s*(.+?)\s*\]\]',re.DOTALL)
class html2html(object):
def __init__(self, html, localcontext):
self.localcontext = localcontext
@ -48,6 +48,7 @@ class html2html(object):
if len(child):
for n in new_child:
new_child.text = utils._process_text(self, child.text)
new_child.tail = utils._process_text(self, child.tail)
new_child.remove(n)
process_text(child, new_child)
else:
@ -66,6 +67,7 @@ class html2html(object):
else :
new_child.getparent().remove(new_child)
new_child.text = utils._process_text(self, child.text)
new_child.tail = utils._process_text(self, child.tail)
self._node = copy.deepcopy(self.etree)
for n in self._node:
self._node.remove(n)