parent
0cba1b3407
commit
e048250071
|
@ -280,6 +280,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
<field colspan="4" name="domain"/>
|
||||
<field colspan="4" name="context"/>
|
||||
<field name="limit"/>
|
||||
<field name="auto_refresh"/>
|
||||
<newline/>
|
||||
|
|
|
@ -45,6 +45,7 @@ class res_currency(osv.osv):
|
|||
date=context['date']
|
||||
else:
|
||||
date=time.strftime('%Y-%m-%d')
|
||||
date= date or time.strftime('%Y-%m-%d')
|
||||
for id in ids:
|
||||
cr.execute("SELECT currency_id, rate FROM res_currency_rate WHERE currency_id = %d AND name <= '%s' ORDER BY name desc LIMIT 1" % (id, date))
|
||||
if cr.rowcount:
|
||||
|
|
|
@ -788,6 +788,11 @@ class orm_template(object):
|
|||
'fields': xfields
|
||||
}
|
||||
attrs = {'views': views}
|
||||
if node.hasAttribute('widget') and node.getAttribute('widget')=='selection':
|
||||
# We can not use the domain has it is defined according to the record !
|
||||
attrs['selection'] = self.pool.get(relation).name_search(cr, user, '', context=context)
|
||||
if not attrs.get('required',False):
|
||||
attrs['selection'].append((False,''))
|
||||
fields[node.getAttribute('name')] = attrs
|
||||
|
||||
elif node.nodeType==node.ELEMENT_NODE and node.localName in ('form', 'tree'):
|
||||
|
@ -894,7 +899,6 @@ class orm_template(object):
|
|||
context = {}
|
||||
def _inherit_apply(src, inherit):
|
||||
def _find(node, node2):
|
||||
# Check if xpath query or normal inherit (with field matching)
|
||||
if node2.nodeType == node2.ELEMENT_NODE and node2.localName == 'xpath':
|
||||
res = xpath.Evaluate(node2.getAttribute('expr'), node)
|
||||
return res and res[0]
|
||||
|
@ -1245,6 +1249,11 @@ class orm_memory(orm_template):
|
|||
field_value2[i][field2] = field_value[i][field2]
|
||||
field_value = field_value2
|
||||
value[field] = field_value
|
||||
|
||||
# get the default values from the context
|
||||
for key in context or {}:
|
||||
if key.startswith('default_'):
|
||||
value[key[8:]] = context[key]
|
||||
return value
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None,
|
||||
|
@ -1680,6 +1689,9 @@ class orm(orm_template):
|
|||
field_value2[i][field2] = field_value[i][field2]
|
||||
field_value = field_value2
|
||||
value[field] = field_value
|
||||
for key in context or {}:
|
||||
if key.startswith('default_'):
|
||||
value[key[8:]] = context[key]
|
||||
return value
|
||||
|
||||
|
||||
|
|
|
@ -97,12 +97,13 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None):
|
|||
a_eval = node.getAttribute('eval')
|
||||
if len(a_eval):
|
||||
import time
|
||||
idref['time'] = time
|
||||
idref2 = idref.copy()
|
||||
idref2['time'] = time
|
||||
import release
|
||||
idref['version'] = release.version.rsplit('.', 1)[0]
|
||||
idref['ref'] = lambda x: self.id_get(cr, False, x)
|
||||
idref2['version'] = release.version.rsplit('.', 1)[0]
|
||||
idref2['ref'] = lambda x: self.id_get(cr, False, x)
|
||||
if len(f_model):
|
||||
idref['obj'] = _obj(self.pool, cr, uid, f_model, context=context)
|
||||
idref2['obj'] = _obj(self.pool, cr, uid, f_model, context=context)
|
||||
try:
|
||||
import pytz
|
||||
except:
|
||||
|
@ -111,8 +112,8 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None):
|
|||
class pytzclass(object):
|
||||
all_timezones=[]
|
||||
pytz=pytzclass()
|
||||
idref['pytz'] = pytz
|
||||
return eval(a_eval, idref)
|
||||
idref2['pytz'] = pytz
|
||||
return eval(a_eval, idref2)
|
||||
if t == 'xml':
|
||||
def _process(s, idref):
|
||||
m = re.findall('[^%]%\((.*?)\)[ds]', s)
|
||||
|
@ -842,7 +843,7 @@ def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate =
|
|||
logger.notifyChannel('init', netsvc.LOG_ERROR, relaxng.error_log.last_error)
|
||||
raise
|
||||
|
||||
if not idref:
|
||||
if idref is None:
|
||||
idref={}
|
||||
if report is None:
|
||||
report=assertion_report()
|
||||
|
|
Loading…
Reference in New Issue