[MERGE] merged the main server code

bzr revid: qdp-launchpad@openerp.com-20120329111943-wt81xc8if89rpy4w
This commit is contained in:
Quentin (OpenERP) 2012-03-29 13:19:43 +02:00
commit 808e441390
8 changed files with 923 additions and 406 deletions

View File

@ -27,10 +27,10 @@
parent="base.menu_custom" name="Reporting" sequence="30"
/>
<menuitem id="base.menu_reporting" name="Reporting" sequence="45" groups="base.group_extended"/>
<menuitem id="base.menu_dasboard" name="Dashboards" sequence="0" parent="base.menu_reporting" groups="base.group_extended"/>
<menuitem id="menu_audit" name="Audit" parent="base.menu_reporting" sequence="50"/>
<menuitem id="base.menu_reporting_config" name="Configuration" parent="base.menu_reporting" sequence="100"/>
<menuitem id="base.menu_reporting" name="Reporting" sequence="45"/>
<menuitem id="base.menu_reporting_dashboard" name="Dashboards" sequence="0" parent="base.menu_reporting" groups="base.group_extended"/>
<menuitem id="menu_audit" name="Audit" parent="base.menu_reporting" sequence="50" groups="base.group_system"/>
<menuitem id="base.menu_reporting_config" name="Configuration" parent="base.menu_reporting" sequence="100" groups="base.group_system"/>
</data>
</openerp>

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ class ir_property(osv.osv):
'fields_id': fields.many2one('ir.model.fields', 'Field', ondelete='cascade', required=True, select=1),
'value_float' : fields.float('Value'),
'value_integer' : fields.integer_big('Value'), # will contain (int, bigint)
'value_integer' : fields.integer('Value'),
'value_text' : fields.text('Value'), # will contain (char, text)
'value_binary' : fields.binary('Value'),
'value_reference': fields.reference('Value', selection=_models_get2, size=128),
@ -65,7 +65,6 @@ class ir_property(osv.osv):
('float', 'Float'),
('boolean', 'Boolean'),
('integer', 'Integer'),
('integer_big', 'Integer Big'),
('text', 'Text'),
('binary', 'Binary'),
('many2one', 'Many2One'),
@ -100,7 +99,6 @@ class ir_property(osv.osv):
'float': 'value_float',
'boolean' : 'value_integer',
'integer': 'value_integer',
'integer_big': 'value_integer',
'text': 'value_text',
'binary': 'value_binary',
'many2one': 'value_reference',
@ -142,7 +140,7 @@ class ir_property(osv.osv):
return record.value_float
elif record.type == 'boolean':
return bool(record.value_integer)
elif record.type in ('integer', 'integer_big'):
elif record.type == 'integer':
return record.value_integer
elif record.type == 'binary':
return record.value_binary

View File

@ -31,7 +31,7 @@
<separator colspan="4" string="Field Information"/>
<field colspan="4" name="fields_id" select="1"/>
<field colspan="4" name="type"/>
<group colspan="4" attrs="{'invisible' : [('type', 'not in', ('integer', 'integer_big', 'boolean'))]}">
<group colspan="4" attrs="{'invisible' : [('type', 'not in', ('integer', 'boolean'))]}">
<field colspan="4" name="value_integer" widget="integer"/>
</group>
<group colspan="4" attrs="{'invisible' : [('type', '!=', 'float')]}">

View File

@ -41,7 +41,7 @@
<menuitem id="menu_localisation" name="Localisation" parent="menu_config_address_book" sequence="1"/>
<menuitem action="action_country" id="menu_country_partner" parent="menu_localisation" sequence="0"/>
<menuitem action="action_country" id="menu_country_partner" parent="menu_localisation" sequence="0" groups="base.group_no_one"/>
<!--
State
@ -82,7 +82,7 @@
<field name="help">If you are working on the American market, you can manage the different federal states you are working on from here. Each state is attached to one country.</field>
</record>
<menuitem action="action_country_state" id="menu_country_state_partner" parent="menu_localisation" sequence="1"/>
<menuitem action="action_country_state" id="menu_country_state_partner" parent="menu_localisation" sequence="1" groups="base.group_no_one"/>
</data>
</openerp>

View File

@ -15,7 +15,7 @@
<menuitem id="menu_base_config" name="Configuration" parent="menu_base_partner" sequence="30"
groups="group_system"/>
<menuitem id="menu_config_address_book" name="Address Book" parent="menu_base_config" sequence="2"
<menuitem id="menu_config_address_book" name="Address Book" parent="menu_base_config" sequence="40"
groups="group_system"/>
<!--
@ -289,7 +289,7 @@
<field name="help">Manage the partner titles you want to have available in your system. The partner titles is the legal status of the company: Private Limited, SA, etc.</field>
</record>
<menuitem action="action_partner_title_partner" id="menu_partner_title_partner" parent="menu_config_address_book" sequence="2"/>
<menuitem action="action_partner_title_partner" id="menu_partner_title_partner" parent="menu_config_address_book" sequence="2" groups="base.group_no_one"/>
<record id="action_partner_title_contact" model="ir.actions.act_window">
<field name="name">Contact Titles</field>
@ -301,7 +301,7 @@
<field name="help">Manage the contact titles you want to have available in your system and the way you want to print them in letters and other documents. Some example: Mr., Mrs. </field>
</record>
<menuitem action="action_partner_title_contact" id="menu_partner_title_contact" name="Contact Titles" parent="menu_config_address_book" sequence="3"/>
<menuitem action="action_partner_title_contact" id="menu_partner_title_contact" name="Contact Titles" parent="menu_config_address_book" sequence="3" groups="base.group_no_one"/>
<!--
=======================
Partner
@ -746,7 +746,7 @@
<field name="help">Manage the partner categories in order to better classify them for tracking and analysis purposes. A partner may belong to several categories and categories have a hierarchy structure: a partner belonging to a category also belong to his parent category.</field>
</record>
<menuitem action="action_partner_category_form" id="menu_partner_category_form" name="Partner Categories" sequence="4" parent="menu_config_address_book" groups="base.group_extended"/>
<menuitem action="action_partner_category_form" id="menu_partner_category_form" name="Partner Categories" sequence="4" parent="menu_config_address_book" groups="base.group_no_one"/>
<act_window domain="[('partner_id', '=', active_id)]" context="{'default_partner_id':active_id}"
id="act_res_partner_event" name="Events"

View File

@ -159,32 +159,6 @@ class integer(_column):
" `required` has no effect, as NULL values are "
"automatically turned into 0.")
class integer_big(_column):
"""Experimental 64 bit integer column type, currently unused.
TODO: this field should work fine for values up
to 32 bits, but greater values will not fit
in the XML-RPC int type, so a specific
get() method is needed to pass them as floats,
like what we do for integer functional fields.
"""
_type = 'integer_big'
# do not reference the _symbol_* of integer class, as that would possibly
# unbind the lambda functions
_symbol_c = '%s'
_symbol_f = lambda x: int(x or 0)
_symbol_set = (_symbol_c, _symbol_f)
_symbol_get = lambda self,x: x or 0
_deprecated = True
def __init__(self, string='unknown', required=False, **args):
super(integer_big, self).__init__(string=string, required=required, **args)
if required:
_logger.debug(
"required=True is deprecated: making an integer_big field"
" `required` has no effect, as NULL values are "
"automatically turned into 0.")
class reference(_column):
_type = 'reference'
_classic_read = False # post-process to handle missing target
@ -347,20 +321,6 @@ class datetime(_column):
exc_info=True)
return timestamp
class time(_column):
_type = 'time'
_deprecated = True
@staticmethod
def now( *args):
""" Returns the current time in a format fit for being a
default value to a ``time`` field.
This method should be proivided as is to the _defaults dict,
it should not be called.
"""
return DT.datetime.now().strftime(
tools.DEFAULT_SERVER_TIME_FORMAT)
class binary(_column):
_type = 'binary'
_symbol_c = '%s'
@ -426,34 +386,6 @@ class selection(_column):
# (4, ID) link
# (5) unlink all (only valid for one2many)
#
#CHECKME: dans la pratique c'est quoi la syntaxe utilisee pour le 5? (5) ou (5, 0)?
class one2one(_column):
_classic_read = False
_classic_write = True
_type = 'one2one'
_deprecated = True
def __init__(self, obj, string='unknown', **args):
_logger.warning("The one2one field is deprecated and doesn't work anymore.")
_column.__init__(self, string=string, **args)
self._obj = obj
def set(self, cr, obj_src, id, field, act, user=None, context=None):
if not context:
context = {}
obj = obj_src.pool.get(self._obj)
self._table = obj_src.pool.get(self._obj)._table
if act[0] == 0:
id_new = obj.create(cr, user, act[1])
cr.execute('update '+obj_src._table+' set '+field+'=%s where id=%s', (id_new, id))
else:
cr.execute('select '+field+' from '+obj_src._table+' where id=%s', (act[0],))
id = cr.fetchone()[0]
obj.write(cr, user, [id], act[1], context=context)
def search(self, cr, obj, args, name, value, offset=0, limit=None, uid=None, context=None):
return obj.pool.get(self._obj).search(cr, uid, args+self._domain+[('name', 'like', value)], offset, limit, context=context)
class many2one(_column):
_classic_read = False
@ -1079,7 +1011,7 @@ class function(_column):
self._symbol_f = boolean._symbol_f
self._symbol_set = boolean._symbol_set
if type in ['integer','integer_big']:
if type == 'integer':
self._symbol_c = integer._symbol_c
self._symbol_f = integer._symbol_f
self._symbol_set = integer._symbol_set
@ -1119,7 +1051,7 @@ class function(_column):
elif not context.get('bin_raw'):
result = sanitize_binary_value(value)
if field_type in ("integer","integer_big") and value > xmlrpclib.MAXINT:
if field_type == "integer" and value > xmlrpclib.MAXINT:
# integer/long values greater than 2^31-1 are not supported
# in pure XMLRPC, so we have to pass them as floats :-(
# This is not needed for stored fields and non-functional integer
@ -1588,7 +1520,7 @@ def field_to_dict(model, cr, user, field, context=None):
else:
# call the 'dynamic selection' function
res['selection'] = field.selection(model, cr, user, context)
if res['type'] in ('one2many', 'many2many', 'many2one', 'one2one'):
if res['type'] in ('one2many', 'many2many', 'many2one'):
res['relation'] = field._obj
res['domain'] = field._domain
res['context'] = field._context

View File

@ -413,7 +413,7 @@ class browse_record(object):
for result_line in field_values:
new_data = {}
for field_name, field_column in fields_to_fetch:
if field_column._type in ('many2one', 'one2one'):
if field_column._type == 'many2one':
if result_line[field_name]:
obj = self._table.pool.get(field_column._obj)
if isinstance(result_line[field_name], (list, tuple)):
@ -544,10 +544,8 @@ def pg_varchar(size=0):
FIELDS_TO_PGTYPES = {
fields.boolean: 'bool',
fields.integer: 'int4',
fields.integer_big: 'int8',
fields.text: 'text',
fields.date: 'date',
fields.time: 'time',
fields.datetime: 'timestamp',
fields.binary: 'bytea',
fields.many2one: 'int4',
@ -1530,11 +1528,11 @@ class BaseModel(object):
for id, field, field_value in res:
if field in fields_list:
fld_def = (field in self._columns) and self._columns[field] or self._inherit_fields[field][2]
if fld_def._type in ('many2one', 'one2one'):
if fld_def._type == 'many2one':
obj = self.pool.get(fld_def._obj)
if not obj.search(cr, uid, [('id', '=', field_value or False)]):
continue
if fld_def._type in ('many2many'):
if fld_def._type == 'many2many':
obj = self.pool.get(fld_def._obj)
field_value2 = []
for i in range(len(field_value)):
@ -1543,18 +1541,18 @@ class BaseModel(object):
continue
field_value2.append(field_value[i])
field_value = field_value2
if fld_def._type in ('one2many'):
if fld_def._type == 'one2many':
obj = self.pool.get(fld_def._obj)
field_value2 = []
for i in range(len(field_value)):
field_value2.append({})
for field2 in field_value[i]:
if field2 in obj._columns.keys() and obj._columns[field2]._type in ('many2one', 'one2one'):
if field2 in obj._columns.keys() and obj._columns[field2]._type == 'many2one':
obj2 = self.pool.get(obj._columns[field2]._obj)
if not obj2.search(cr, uid,
[('id', '=', field_value[i][field2])]):
continue
elif field2 in obj._inherit_fields.keys() and obj._inherit_fields[field2][2]._type in ('many2one', 'one2one'):
elif field2 in obj._inherit_fields.keys() and obj._inherit_fields[field2][2]._type == 'many2one':
obj2 = self.pool.get(obj._inherit_fields[field2][2]._obj)
if not obj2.search(cr, uid,
[('id', '=', field_value[i][field2])]):
@ -4357,7 +4355,7 @@ class BaseModel(object):
for v in value:
if v not in val:
continue
if self._columns[v]._type in ('many2one', 'one2one'):
if self._columns[v]._type == 'many2one':
try:
value[v] = value[v][0]
except:
@ -4379,7 +4377,7 @@ class BaseModel(object):
if f in field_dict[r]:
result.pop(r)
for id, value in result.items():
if self._columns[f]._type in ('many2one', 'one2one'):
if self._columns[f]._type == 'many2one':
try:
value = value[0]
except:
@ -4656,7 +4654,7 @@ class BaseModel(object):
data[f] = data[f] and data[f][0]
except:
pass
elif ftype in ('one2many', 'one2one'):
elif ftype == 'one2many':
res = []
rel = self.pool.get(fields[f]['relation'])
if data[f]:
@ -4707,7 +4705,7 @@ class BaseModel(object):
translation_records = []
for field_name, field_def in fields.items():
# we must recursively copy the translations for o2o and o2m
if field_def['type'] in ('one2one', 'one2many'):
if field_def['type'] == 'one2many':
target_obj = self.pool.get(field_def['relation'])
old_record, new_record = self.read(cr, uid, [old_id, new_id], [field_name], context=context)
# here we rely on the order of the ids to match the translations