# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+# $Id$
#
-# $Id$
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-###############################################################################
+##############################################################################
#
# Object relationnal mapping to postgresql module
view_load=%s, select_level=%s, readonly=%s ,required=%s
WHERE
model=%s AND name=%s""", (
- vals['model_id'], vals['field_description'], vals['ttype'],
+ vals['model_id'], vals['field_description'], vals['ttype'],
vals['relation'], bool(vals['view_load']),
vals['select_level'], bool(vals['readonly']),bool(vals['required']), vals['model'], vals['name']
))
if val:
val2 = translation_obj._get_source(cr, user,
self._name + ',' + f, 'selection',
- context.get('lang', False) or 'en_US', val)
+ context.get('lang', False) or 'en_US', val)
sel2.append((key, val2 or val))
sel = sel2
res[f]['selection'] = sel
'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'):
result = self.view_header_get(cr, user, False, node.localName, context)
if result:
node.setAttribute('string', result.decode('utf-8'))
+
+ elif node.nodeType==node.ELEMENT_NODE and node.localName == 'calendar':
+ for additional_field in ('date_start', 'date_delay', 'date_stop', 'color'):
+ if node.hasAttribute(additional_field) and node.getAttribute(additional_field):
+ fields[node.getAttribute(additional_field)] = {}
+
if node.nodeType == node.ELEMENT_NODE and node.hasAttribute('groups'):
if node.getAttribute('groups'):
groups = node.getAttribute('groups').split(',')
continue
ok = True
-
+
if user != 1: # admin user has all roles
serv = netsvc.LocalService('object_proxy')
user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id']
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]
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,
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