[MERGE] forward port of latest saas-2 until rev 4996 dle@openerp.com-20131218123130-vlejjv7r2klkzoj0

bzr revid: mat@openerp.com-20131218160041-58x5kij4v7earagu
This commit is contained in:
Martin Trigaux 2013-12-18 17:00:41 +01:00
commit 79f716c70f
6 changed files with 22 additions and 17 deletions

View File

@ -242,6 +242,8 @@ class ir_attachment(osv.osv):
# performed in batch as much as possible.
ima = self.pool.get('ir.model.access')
for model, targets in model_attachments.iteritems():
if model not in self.pool:
continue
if not ima.check(cr, uid, model, 'read', False):
# remove all corresponding attachment ids
for attach_id in itertools.chain(*targets.values()):

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="initial_bottom_pos">20.5</xsl:variable>
<xsl:variable name="initial_left_pos">1</xsl:variable>
<xsl:variable name="height_increment">6.5</xsl:variable>
<xsl:variable name="width_increment">10</xsl:variable>
<xsl:variable name="frame_height">5.5cm</xsl:variable>
<xsl:variable name="frame_width">10cm</xsl:variable>
<xsl:variable name="number_columns">2</xsl:variable>
<xsl:variable name="max_frames">8</xsl:variable>
<xsl:variable name="initial_bottom_pos">24.5</xsl:variable>
<xsl:variable name="initial_left_pos">0.5</xsl:variable>
<xsl:variable name="height_increment">3.5</xsl:variable>
<xsl:variable name="width_increment">7</xsl:variable>
<xsl:variable name="frame_height">3.7cm</xsl:variable>
<xsl:variable name="frame_width">7cm</xsl:variable>
<xsl:variable name="number_columns">3</xsl:variable>
<xsl:variable name="max_frames">24</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="addresses"/>

View File

@ -274,7 +274,7 @@
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<form string="Users" version="7.0">
<field name="image" widget='image' class="oe_right oe_avatar" options='{"preview_image": "image_small"}'/>
<field name="image" readonly="0" widget='image' class="oe_right oe_avatar" options='{"preview_image": "image_small"}'/>
<h1>
<field name="name" readonly="1" class="oe_inline"/>
</h1>

View File

@ -601,8 +601,10 @@ class one2many(_column):
else:
cr.execute('update '+_table+' set '+self._fields_id+'=null where id=%s', (act[1],))
elif act[0] == 4:
# Must use write() to recompute parent_store structure if needed
obj.write(cr, user, [act[1]], {self._fields_id:id}, context=context or {})
cr.execute("select 1 from {0} where id=%s and {1}=%s".format(_table, self._fields_id), (act[1], id))
if not cr.fetchone():
# Must use write() to recompute parent_store structure if needed and check access rules
obj.write(cr, user, [act[1]], {self._fields_id:id}, context=context or {})
elif act[0] == 5:
reverse_rel = obj._all_columns.get(self._fields_id)
assert reverse_rel, 'Trying to unlink the content of a o2m but the pointed model does not have a m2o'

View File

@ -3681,11 +3681,6 @@ class BaseModel(object):
if fields_to_read is None:
fields_to_read = self._columns.keys()
# Construct a clause for the security rules.
# 'tables' hold the list of tables necessary for the SELECT including the ir.rule clauses,
# or will at least contain self._table.
rule_clause, rule_params, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name, 'read', context=context)
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True
fields_pre = [f for f in fields_to_read if
f == self.CONCURRENCY_CHECK_FIELD
@ -3706,6 +3701,11 @@ class BaseModel(object):
return 'length(%s) as "%s"' % (f_qual, f)
return f_qual
# Construct a clause for the security rules.
# 'tables' hold the list of tables necessary for the SELECT including the ir.rule clauses,
# or will at least contain self._table.
rule_clause, rule_params, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name, 'read', context=context)
fields_pre2 = map(convert_field, fields_pre)
order_by = self._parent_order or self._order
select_fields = ','.join(fields_pre2 + ['%s.id' % self._table])
@ -3720,6 +3720,7 @@ class BaseModel(object):
self._check_record_rules_result_count(cr, user, sub_ids, result_ids, 'read', context=context)
res.extend(results)
else:
self.check_access_rule(cr, user, ids, 'read', context=context)
res = map(lambda x: {'id': x}, ids)
if context.get('lang'):

View File

@ -952,7 +952,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
result, rows, warning_msg, dummy = registry[model].import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial)
if result < 0:
# Report failed import and abort module install
raise Exception(_('Module loading failed: file %s/%s could not be processed:\n %s') % (module, fname, warning_msg))
raise Exception(_('Module loading %s failed: file %s could not be processed:\n %s') % (module, fname, warning_msg))
if config.get('import_partial'):
data = pickle.load(file(config.get('import_partial')))
data[fname_partial] = 0