Forward-port of latest saas-4, up to revision 5211 (revid fme@openerp.com-20140509164408-rtml4brrhpiv4zz9)

This commit is contained in:
Martin Trigaux 2014-05-12 10:05:23 +02:00
commit 4f5cc00420
8 changed files with 19 additions and 18 deletions

View File

@ -384,7 +384,7 @@ class ir_model_fields(osv.osv):
# static table of properties # static table of properties
model_props = [ # (our-name, fields.prop, set_fn) model_props = [ # (our-name, fields.prop, set_fn)
('field_description', 'string', str), ('field_description', 'string', tools.ustr),
('required', 'required', bool), ('required', 'required', bool),
('readonly', 'readonly', bool), ('readonly', 'readonly', bool),
('domain', '_domain', eval), ('domain', '_domain', eval),

View File

@ -218,13 +218,6 @@ class view(osv.osv):
self.read_template.clear_cache(self) self.read_template.clear_cache(self)
ret = super(view, self).write(cr, uid, ids, vals, context) ret = super(view, self).write(cr, uid, ids, vals, context)
# if arch is modified views become noupdatable
if 'arch' in vals and not context.get('install_mode', False):
# TODO: should be doable in a read and a write
for view_ in self.browse(cr, uid, ids, context=context):
if view_.model_data_id:
self.pool.get('ir.model.data').write(cr, openerp.SUPERUSER_ID, view_.model_data_id.id, {'noupdate': True})
return ret return ret
def copy(self, cr, uid, id, default=None, context=None): def copy(self, cr, uid, id, default=None, context=None):

View File

@ -156,10 +156,12 @@
<label for="street" string="Address"/> <label for="street" string="Address"/>
<div> <div>
<field name="use_parent_address" class="oe_edit_only oe_inline" <div class="oe_edit_only">
on_change="onchange_address(use_parent_address, parent_id)" <field name="use_parent_address" class="oe_inline"
attrs="{'invisible': ['|', ('is_company', '=', True),('parent_id', '=', False)]}"/> on_change="onchange_address(use_parent_address, parent_id)"
<label for="use_parent_address" class="oe_edit_only" attrs="{'invisible': ['|', ('is_company', '=', True), ('parent_id', '=', False)]}"/> attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
<label for="use_parent_address" attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
</div>
<button name="open_parent" type="object" string="(edit company address)" class="oe_link oe_edit_only" <button name="open_parent" type="object" string="(edit company address)" class="oe_link oe_edit_only"
attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/> attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/>
<field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/> <field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/>

View File

@ -99,7 +99,7 @@ class res_groups(osv.osv):
} }
_sql_constraints = [ _sql_constraints = [
('name_uniq', 'unique (category_id, name)', 'The name of the group must be unique !') ('name_uniq', 'unique (category_id, name)', 'The name of the group must be unique within an application!')
] ]
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):

View File

@ -43,7 +43,7 @@
<!-- Set accesses to menu --> <!-- Set accesses to menu -->
<record model="ir.ui.menu" id="base.menu_administration"> <record model="ir.ui.menu" id="base.menu_administration">
<field name="name">Administration</field> <field name="name">Settings</field>
<field name="groups_id" eval="[(6,0, [ref('group_system'), ref('group_erp_manager')])]"/> <field name="groups_id" eval="[(6,0, [ref('group_system'), ref('group_erp_manager')])]"/>
</record> </record>

View File

@ -177,7 +177,7 @@ def load_information_from_description_file(module, mod_path=None):
if not mod_path: if not mod_path:
mod_path = get_module_path(module) mod_path = get_module_path(module)
terp_file = opj(mod_path, '__openerp__.py') terp_file = mod_path and opj(mod_path, '__openerp__.py') or False
if terp_file: if terp_file:
info = {} info = {}
if os.path.isfile(terp_file): if os.path.isfile(terp_file):

View File

@ -305,12 +305,17 @@ form: module.record_id""" % (xml_id,)
if d_search: if d_search:
idref = _get_idref(self, cr, self.uid, d_model, context={}, idref={}) idref = _get_idref(self, cr, self.uid, d_model, context={}, idref={})
ids = self.pool[d_model].search(cr, self.uid, unsafe_eval(d_search, idref)) try:
ids = self.pool[d_model].search(cr, self.uid, unsafe_eval(d_search, idref))
except ValueError:
_logger.warning('Skipping deletion for failed search `%r`', d_search, exc_info=True)
pass
if d_id: if d_id:
try: try:
ids.append(self.id_get(cr, d_id)) ids.append(self.id_get(cr, d_id))
except: except ValueError:
# d_id cannot be found. doesn't matter in this case # d_id cannot be found. doesn't matter in this case
_logger.warning('Skipping deletion for missing XML ID `%r`', d_id, exc_info=True)
pass pass
if ids: if ids:
self.pool[d_model].unlink(cr, self.uid, ids) self.pool[d_model].unlink(cr, self.uid, ids)

View File

@ -71,7 +71,8 @@ _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'CONTINUE_LOOP', 'RAISE_VARARGS', 'CONTINUE_LOOP', 'RAISE_VARARGS',
# New in Python 2.7 - http://bugs.python.org/issue4715 : # New in Python 2.7 - http://bugs.python.org/issue4715 :
'JUMP_IF_FALSE_OR_POP', 'JUMP_IF_TRUE_OR_POP', 'POP_JUMP_IF_FALSE', 'JUMP_IF_FALSE_OR_POP', 'JUMP_IF_TRUE_OR_POP', 'POP_JUMP_IF_FALSE',
'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'END_FINALLY', 'LOAD_FAST', 'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'END_FINALLY',
'LOAD_FAST', 'STORE_FAST', 'DELETE_FAST',
'LOAD_GLOBAL', # Only allows access to restricted globals 'LOAD_GLOBAL', # Only allows access to restricted globals
] if x in opmap)) ] if x in opmap))