[MERGE] merged trunk.

bzr revid: vmt@openerp.com-20111117150736-6d3ee8pt35o7xu0f
This commit is contained in:
Vo Minh Thu 2011-11-17 16:07:36 +01:00
commit e2d8f8b1df
6 changed files with 19 additions and 9 deletions

View File

@ -1580,7 +1580,6 @@
<record id="res_bank_1" model="res.bank">
<field name="name">Reserve</field>
<field name="code">RSV</field>
</record>
<record id="CRC" model="res.currency">
@ -1600,7 +1599,7 @@
<field name="name">localhost</field>
<field name="smtp_host">localhost</field>
<field eval="25" name="smtp_port"/>
<field eval="10" name="priority"/>
<field eval="10" name="sequence"/>
</record>
<record id="MUR" model="res.currency">

View File

@ -75,7 +75,6 @@
<field eval="'ir.module.category'" name="model"/>
<field name="name">Categorized Modules</field>
<field eval="'ir.actions.act_window,%d'%action_module_open_categ" name="value"/>
<field eval="True" name="object"/>
</record>

View File

@ -71,7 +71,7 @@ class res_config_configurable(osv.osv_memory):
res['nodestroy'] = False
return res
#if there is no next action and if html is in the context: reload instead of closing
if 'html' in context:
if context and 'html' in context:
return {'type' : 'ir.actions.reload'}
return {'type' : 'ir.actions.act_window_close'}

View File

@ -651,7 +651,6 @@
<field eval="'res.partner.category'" name="model"/>
<field name="name">Open partners</field>
<field eval="'ir.actions.act_window,%d'%action_partner_by_category" name="value"/>
<field eval="True" name="object"/>
</record>
<record id="action_partner_category_form" model="ir.actions.act_window">

View File

@ -2478,12 +2478,12 @@ class BaseModel(object):
del d['id']
if groupby and groupby in self._group_by_full:
gids = map(lambda x: x[groupby][0], data)
gids = [x[groupby][0] for x in data if x[groupby]]
stages = self._group_by_full[groupby](self, cr, uid, gids, domain, context)
# as both lists are sorted in the same way, we can merge in one pass
pos = 0
while stages and ((pos<len(data)) or (pos<len(stages))):
if (pos<len(data)) and (data[pos][groupby][0] == stages[pos][0]):
if (pos<len(data)) and (not data[pos][groupby] or (data[pos][groupby][0] == stages[pos][0])):
pos+=1
continue
val = dict.fromkeys(float_int_fields, False)
@ -3825,6 +3825,7 @@ class BaseModel(object):
for id in ids:
result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
unknown_fields = updend[:]
for table in self._inherits:
col = self._inherits[table]
nids = []
@ -3837,9 +3838,14 @@ class BaseModel(object):
for val in updend:
if self._inherit_fields[val][0] == table:
v[val] = vals[val]
unknown_fields.remove(val)
if v:
self.pool.get(table).write(cr, user, nids, v, context)
if unknown_fields:
self.__logger.warn(
'No such field(s) in model %s: %s.',
self._name, ', '.join(unknown_fields))
self._validate(cr, user, ids, context)
# TODO: use _order to set dest at the right position and not first node of parent
@ -3962,6 +3968,7 @@ class BaseModel(object):
tocreate[v] = {'id': vals[self._inherits[v]]}
(upd0, upd1, upd2) = ('', '', [])
upd_todo = []
unknown_fields = []
for v in vals.keys():
if v in self._inherit_fields:
(table, col, col_detail, original_parent) = self._inherit_fields[v]
@ -3970,6 +3977,11 @@ class BaseModel(object):
else:
if (v not in self._inherit_fields) and (v not in self._columns):
del vals[v]
unknown_fields.append(v)
if unknown_fields:
self.__logger.warn(
'No such field(s) in model %s: %s.',
self._name, ', '.join(unknown_fields))
# Try-except added to filter the creation of those records whose filds are readonly.
# Example : any dashboard which has all the fields readonly.(due to Views(database views))

View File

@ -302,8 +302,9 @@ class YamlInterpreter(object):
def create_osv_memory_record(self, record, fields):
model = self.get_model(record.model)
record_dict = self._create_record(model, fields, False)
id_new=model.create(self.cr, self.uid, record_dict, context=self.context)
context = self.get_context(record, self.eval_context)
record_dict = self._create_record(model, fields)
id_new = model.create(self.cr, self.uid, record_dict, context=context)
self.id_map[record.id] = int(id_new)
return record_dict