diff --git a/bin/addons/base/res/res_company.py b/bin/addons/base/res/res_company.py
index dccf08ed2ed..ea64aa5eb16 100644
--- a/bin/addons/base/res/res_company.py
+++ b/bin/addons/base/res/res_company.py
@@ -209,7 +209,7 @@ class res_company(osv.osv):
- [[company.logo]]
+ [[ company.logo or removeParentNode('image') ]]
diff --git a/bin/osv/orm.py b/bin/osv/orm.py
index 9642d8af006..ded8ad7e5d3 100644
--- a/bin/osv/orm.py
+++ b/bin/osv/orm.py
@@ -139,7 +139,7 @@ class browse_record(object):
def __init__(self, cr, uid, id, table, cache, context=None, list_class = None, fields_process={}):
'''
table : the object (inherited from orm)
- context : a dictionary with an optional context
+ context : dictionary with an optional context
'''
if not context:
context = {}
@@ -506,9 +506,9 @@ class orm_template(object):
:param cr: database cursor
:param user: current user id
- :param select: id or a list of ids
+ :param select: id or list of ids
:param context: context arguments, like lang, time zone
- :rtype: object or a list of objects requested
+ :rtype: object or list of objects requested
"""
if not context:
@@ -631,10 +631,10 @@ class orm_template(object):
:param cr: database cursor
:param uid: current user id
- :param ids: a list of ids
- :param fields_to_export: a list of fields
+ :param ids: list of ids
+ :param fields_to_export: list of fields
:param context: context arguments, like lang, time zone, may contain import_comp(default: False) to make exported data compatible with import_data()
- :rtype: a dictionary with a *datas* matrix
+ :rtype: dictionary with a *datas* matrix
This method is used when exporting data via client menu
@@ -673,15 +673,15 @@ class orm_template(object):
:param cr: database cursor
:param uid: current user id
- :param ids: a list of ids
- :param fields: a list of fields
+ :param ids: list of ids
+ :param fields: list of fields
:param data: data to import
:param mode: 'init' or 'update' for record creation
:param current_module: module name
:param noupdate: flag for record creation
:param context: context arguments, like lang, time zone,
:param filename: optional file to store partial import state for recovery
- :rtype: a tuple
+ :rtype: tuple
This method is used when importing data via client menu
@@ -1362,9 +1362,9 @@ class orm_template(object):
:param view_id: id of the view or None
:param view_type: type of the view to return if view_id is None ('form', tree', ...)
:param context: context arguments, like lang, time zone
- :param toolbar: true to include concextual actions
+ :param toolbar: true to include contextual actions
:param submenu: example (portal_project module)
- :return: a dictionary describing the composition of the requested view (including inherited views and extensions)
+ :return: dictionary describing the composition of the requested view (including inherited views and extensions)
:raise AttributeError:
* if the inherited view has unknown position to work with other than 'before', 'after', 'inside', 'replace'
* if some tag other than 'position' is found in parent view
@@ -1934,22 +1934,22 @@ class orm(orm_template):
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
"""
- Get the list of records in list view sorted by the given fields
+ Get the list of records in list view grouped by the given ``groupby`` fields
:param cr: database cursor
:param uid: current user id
- :param domain: a list specifying search criteria [['field_name', 'operator', 'value'], ...]
- :param fields: a list of fields present in the list view specified on the object
- :param groupby: a list of fields on which to sort the records
- :type fields_list: a list (example ['field_name_1', ...])
+ :param domain: list specifying search criteria [['field_name', 'operator', 'value'], ...]
+ :param fields: list of fields present in the list view specified on the object
+ :param groupby: list of fields on which to groupby the records
+ :type fields_list: list (example ['field_name_1', ...])
:param offset: optional number of records to skip
:param limit: optional max number of records to return
:param context: context arguments, like lang, time zone
- :return: a list of dictionaries(one dictionary for each record) containing:
+ :return: list of dictionaries(one dictionary for each record) containing:
- * the values of fields sorted out by the fields in groupby arguement
- * __domain: a list of tuples specifying the search criteria
- * __context: a dictionary with argument like 'groupby'
+ * the values of fields grouped by the fields in ``groupby`` argument
+ * __domain: list of tuples specifying the search criteria
+ * __context: dictionary with argument like ``groupby``
:rtype: [{'field_name_1': value, ...]
:raise AccessError: * if user has no read rights on the requested object
* if user tries to bypass access rules for read on the requested object
@@ -2036,7 +2036,7 @@ class orm(orm_template):
Adds missing table select and join clause(s) for reaching
the field coming from an '_inherits' parent table.
- :param tables: a list of table._table names enclosed in double quotes as returned
+ :param tables: list of table._table names enclosed in double quotes as returned
by _where_calc()
"""
@@ -2494,14 +2494,14 @@ class orm(orm_template):
def default_get(self, cr, uid, fields_list, context=None):
"""
- Get default field values of the given field list of the model
+ To Get default field values of given fields list of the model
:param cr: database cursor
:param uid: current user id
- :param fields_list: a list of fields to get the default value
- :type fields_list: a list (example ['field_name_1', ...])
+ :param fields_list: list of fields to get the default value
+ :type fields_list: list (example ['field1', 'field2',])
:param context: context arguments, like lang, time zone
- :return: a dictionary of the default values for fields (set on the object class, by the user preferences, or via the context)
+ :return: dictionary of the default values for fields (set on the object class, by the user preferences, or via the context)
"""
if not context:
@@ -2600,9 +2600,9 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
- :param fields: a list of fields
+ :param fields: list of fields
:param context: context arguments, like lang, time zone
- :return: a dictionary of field dictionaries, each one describing a field of the business object
+ :return: dictionary of field dictionaries, each one describing a field of the business object
:raise AccessError: * if user has no create/write rights on the requested object
"""
@@ -2617,11 +2617,11 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
- :param ids: id or a list of the ids of the records to read
+ :param ids: id or list of the ids of the records to read
:param fields: optional list of field names to return (default: all fields would be returned)
- :type fields: a list (example ['field_name_1', ...])
+ :type fields: list (example ['field_name_1', ...])
:param context(optional, highly recommended): context arguments, like lang, time zone
- :return: a list of dictionaries((a dictionary per record asked)) with requested field values
+ :return: list of dictionaries((dictionary per record asked)) with requested field values
:rtype: [{‘name_of_the_field’: value, ...}, ...]
:raise AccessError: * if user has no read rights on the requested object
* if user tries to bypass access rules for read on the requested object
@@ -2820,8 +2820,8 @@ class orm(orm_template):
:param ids: id or list of ids
:param context: context arguments, like lang, time zone
:param details: if True, *_uid fields are replaced with the name of the user
- :return: a list of ownership dictionaries for each requested record
- :rtype: a list of dictionaries with the following keys:
+ :return: list of ownership dictionaries for each requested record
+ :rtype: list of dictionaries with the following keys:
* id: object id
* create_uid: user who created the record
@@ -2873,9 +2873,10 @@ class orm(orm_template):
def check_access_rule(self, cr, uid, ids, operation, context=None):
"""Verifies that the operation given by ``operation`` is allowed for the user
according to ir.rules.
- @param ``operation``: one of ``'read'``, ``'write'``, ``'unlink'``
- @raise ``except_orm``: if current ir.rules do not permit this operation.
- @return: ``None`` if the operation is allowed
+
+ :param operation: one of ``write``, ``unlink``
+ :raise except_orm: * if current ir.rules do not permit this operation.
+ :return: None if the operation is allowed
"""
where_clause, where_params, tables = self.pool.get('ir.rule').domain_get(cr, uid, self._name, operation, context=context)
if where_clause:
@@ -2895,7 +2896,7 @@ class orm(orm_template):
:param cr: database cursor
:param uid: current user id
- :param ids: id or a list of ids
+ :param ids: id or list of ids
:param context(optional, highly recommended): context arguments, like lang, time zone
:return: True
:raise AccessError: * if user has no unlink rights on the requested object
@@ -2954,9 +2955,9 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
:type user: integer (example 1)
- :param ids: id or a list of ids
- :param vals: a dictionary of field values to update
- :type vals: a dictionary (example {'field_name':'value', ...})
+ :param ids: id or list of ids
+ :param vals: dictionary of field values to update
+ :type vals: dictionary (example {'field_name': 'value', ...})
:param context(optional, highly recommended): context arguments, like lang, time zone
:return: True
:raise AccessError: * if user has no write rights on the requested object
@@ -3164,10 +3165,10 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
:type user: integer (example 1)
- :param vals: a dictionary for new record {'field_name':field_value, ...}
- :type vals: a dictionary (example {'field_name':field_value, ...})
- :param context(optional, highly recommended): context arguements, like lang, time zone
- :type context: a dictionary (example {'lang':'en_us', ...})
+ :param vals: dictionary for new record {'field_name': field_value, ...}
+ :type vals: dictionary (example {'field_name': field_value, ...})
+ :param context(optional, highly recommended): context arguments, like lang, time zone
+ :type context: dictionary (example {'lang': 'en_us', ...})
:return: id of new record created
:raise AccessError: * if user has no create rights on the requested object
* if user tries to bypass access rules for create on the requested object
@@ -3531,14 +3532,14 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
- :param args: a list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...]
- :param offset: optional number of records to skip
+ :param args: list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...]
+ :param offset: optional number from search starts
:param limit: optional max number of records to return
- :param order: optional columns to sort by (default: self._order )
+ :param order: optional columns to sort by (default: self._order=id )
:param context(optional, highly recommended): context arguments, like lang, time zone
:param count: if True, returns only the number of records matching the criteria, not their ids
- :return: id or a list of ids of records matching the criteria
- :rtype: integer or a list of integers
+ :return: id or list of ids of records matching the criteria
+ :rtype: integer or list of integers
:raise AccessError: * if user tries to bypass access rules for read on the requested object.
Operators:
@@ -3601,7 +3602,7 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
:type user: integer (example 1)
- :param ids: a list of ids
+ :param ids: list of ids
:param context: context arguments, like lang, time zone
:return: tuples with the text representation of requested objects for to-many relationships
@@ -3621,11 +3622,11 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
:param name: object name to search
- :param args: a list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...]
+ :param args: list of tuples specifying search criteria [('field_name', 'operator', 'value'), ...]
:param operator: operator for search criterion
:param context: context arguments, like lang, time zone
:param limit: optional max number of records to return
- :return: a list of object names matching the search criteria, used to provide completition for to-many relationships
+ :return: list of object names matching the search criteria, used to provide completion for to-many relationships
This method is equivalent of search() on name + name_get()
@@ -3648,9 +3649,9 @@ class orm(orm_template):
:param cr: database cursor
:param user: current user id
:param ids: id of the record to copy
- :param default: a dictionary of field values to update before saving the duplicate object
+ :param default: dictionary of field values to update before saving the duplicate object
:param context: context arguments, like lang, time zone
- :return: a dictionary containing all the field values
+ :return: dictionary containing all the field values
"""
if not context:
@@ -3730,8 +3731,8 @@ class orm(orm_template):
:param cr: database cursor
:param uid: current user id
:param id: id of the record to copy
- :param default: a dictionary of field values to update before saving the duplicate object
- :type default: a dictionary (example {'field_name':field_value, ...})
+ :param default: dictionary of field values to update before saving the duplicate object
+ :type default: dictionary (example {'field_name': field_value, ...})
:param context: context arguments, like lang, time zone
:return: True
@@ -3755,7 +3756,7 @@ class orm(orm_template):
:param cr: database cursor
:param uid: current user id
- :param ids: a list of ids of records
+ :param ids: list of ids of records
:param parent: parent field name
:return: True or False based on recursion detection
"""
diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py
index 98d960db1a4..a85bac84f5c 100644
--- a/bin/report/report_sxw.py
+++ b/bin/report/report_sxw.py
@@ -297,11 +297,7 @@ class rml_parse(object):
rml_head = self.rml_header2
else:
rml_head = self.rml_header
- if self.logo and (rml_head.find('company.logo')<0 or rml_head.find('',''' [[company.logo]] ''')
- if not self.logo and rml_head.find('company.logo')>=0:
- rml_head = rml_head.replace('','')
+
head_dom = etree.XML(rml_head)
for tag in head_dom:
found = rml_dom.find('.//'+tag.tag)
@@ -443,9 +439,10 @@ class report_sxw(report_rml, preprocess.report):
rml_parser = self.parser(cr, uid, self.name2, context=context)
objs = self.getObjects(cr, uid, ids, context)
rml_parser.set_context(objs, data, ids, report_xml.report_type)
- processed_rml = self.preprocess_rml(etree.XML(rml),report_xml.report_type)
+ processed_rml = etree.XML(rml)
if report_xml.header:
rml_parser._add_header(processed_rml)
+ processed_rml = self.preprocess_rml(processed_rml,report_xml.report_type)
if rml_parser.logo:
logo = base64.decodestring(rml_parser.logo)
create_doc = self.generators[report_xml.report_type]
@@ -462,13 +459,18 @@ class report_sxw(report_rml, preprocess.report):
sxw_z = zipfile.ZipFile(sxw_io, mode='r')
rml = sxw_z.read('content.xml')
meta = sxw_z.read('meta.xml')
+ mime_type = sxw_z.read('mimetype')
+ if mime_type == 'application/vnd.sun.xml.writer':
+ mime_type = 'sxw'
+ else :
+ mime_type = 'odt'
sxw_z.close()
rml_parser = self.parser(cr, uid, self.name2, context=context)
rml_parser.parents = sxw_parents
rml_parser.tag = sxw_tag
objs = self.getObjects(cr, uid, ids, context)
- rml_parser.set_context(objs, data, ids,report_xml.report_type)
+ rml_parser.set_context(objs, data, ids, mime_type)
rml_dom_meta = node = etree.XML(meta)
elements = node.findall(rml_parser.localcontext['name_space']["meta"]+"user-defined")
@@ -489,7 +491,7 @@ class report_sxw(report_rml, preprocess.report):
for n in rml_dom.iterdescendants():
if n.tag == key1:
elements.append(n)
- if report_type == 'odt':
+ if mime_type == 'odt':
for pe in elements:
e = pe.findall(key2)
for de in e:
@@ -520,8 +522,8 @@ class report_sxw(report_rml, preprocess.report):
if de.getparent():
pp.remove(de)
- rml_dom = self.preprocess_rml(rml_dom,report_type)
- create_doc = self.generators[report_type]
+ rml_dom = self.preprocess_rml(rml_dom, mime_type)
+ create_doc = self.generators[mime_type]
odt = etree.tostring(create_doc(rml_dom, rml_parser.localcontext),
encoding='utf-8', xml_declaration=True)
sxw_z = zipfile.ZipFile(sxw_io, mode='a')
@@ -547,7 +549,7 @@ class report_sxw(report_rml, preprocess.report):
sxw_z.close()
final_op = sxw_io.getvalue()
sxw_io.close()
- return (final_op, report_type)
+ return (final_op, mime_type)
def create_single_html2html(self, cr, uid, ids, data, report_xml, context=None):
if not context: