[MERGE] merge with lp:~openerp-dev/openobject-server/trunk-dev-framework/
bzr revid: ysa@tinyerp.co.in-20100413063438-nuach19tw7wltwz8
This commit is contained in:
@@ -114,14 +114,14 @@
|
||||
</para>
|
||||
</xsl:when>
|
||||
<xsl:when test="@tree='float'">
|
||||
<para style="float_right"><font fontName="Helvetica-bold" fontSize="9">
|
||||
<para style="float_right"><font fontName="Helvetica-bold" fontSize="9" color="blue">
|
||||
<xsl:value-of select="."/>
|
||||
</font></para>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<para>
|
||||
<font fontName="Helvetica-bold" fontSize="9">
|
||||
<font fontName="Helvetica-bold" fontSize="9" color="blue">
|
||||
<xsl:value-of select="."/>
|
||||
</font>
|
||||
</para>
|
||||
|
||||
@@ -346,8 +346,7 @@
|
||||
<filter string="My Partners" icon="terp-partner" domain="[('user_id','=',uid)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Customers" icon="terp-partner" domain="[('customer','=',1)]" help="Customer Partners"/>
|
||||
<filter string="Suppliers" icon="terp-partner" domain="[('supplier','=',1)]" help="Supplier Partners"
|
||||
default="context.get('default_supplier',False)"/>
|
||||
<filter string="Suppliers" icon="terp-partner" domain="[('supplier','=',1)]" help="Supplier Partners"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="address" select="1"/>
|
||||
@@ -364,6 +363,7 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{"search_default_Suppliers":1}</field>
|
||||
<field name="search_view_id" ref="view_res_partner_filter"/>
|
||||
</record>
|
||||
<record id="action_partner_form_view1" model="ir.actions.act_window.view">
|
||||
|
||||
@@ -209,7 +209,7 @@ class res_company(osv.osv):
|
||||
<frame id="first" x1="1.3cm" y1="2.5cm" height="23.0cm" width="19cm"/>
|
||||
<pageGraphics>
|
||||
<!-- You Logo - Change X,Y,Width and Height -->
|
||||
<image x="1.3cm" y="27.6cm" height="40.0" >[[company.logo]]</image>
|
||||
<image x="1.3cm" y="27.6cm" height="40.0" >[[ company.logo or removeParentNode('image') ]]</image>
|
||||
<setFont name="DejaVu Sans" size="8"/>
|
||||
<fill color="black"/>
|
||||
<stroke color="black"/>
|
||||
|
||||
@@ -541,7 +541,6 @@
|
||||
<rng:define name="filter">
|
||||
<rng:element name="filter">
|
||||
<rng:optional><rng:attribute name="attrs"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="name" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="separator" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="icon" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="string" /></rng:optional>
|
||||
@@ -554,7 +553,6 @@
|
||||
<rng:optional><rng:attribute name="context"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="help"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="domain"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="default"/></rng:optional>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:ref name="form" />
|
||||
|
||||
@@ -81,7 +81,6 @@ class _column(object):
|
||||
self.select = select
|
||||
self.selectable = True
|
||||
self.group_operator = args.get('group_operator', False)
|
||||
self.parent_field = args.get('parent_field', False)
|
||||
for a in args:
|
||||
if args[a]:
|
||||
setattr(self, a, args[a])
|
||||
@@ -367,7 +366,6 @@ class one2many(_column):
|
||||
_type = 'one2many'
|
||||
|
||||
def __init__(self, obj, fields_id, string='unknown', limit=None, **args):
|
||||
args.update({'parent_field':fields_id})
|
||||
_column.__init__(self, string=string, **args)
|
||||
self._obj = obj
|
||||
self._fields_id = fields_id
|
||||
|
||||
+59
-57
@@ -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
|
||||
|
||||
@@ -1072,7 +1072,7 @@ class orm_template(object):
|
||||
continue
|
||||
res[f] = {'type': self._columns[f]._type}
|
||||
for arg in ('string', 'readonly', 'states', 'size', 'required', 'group_operator',
|
||||
'change_default', 'translate', 'help', 'select', 'selectable','parent_field'):
|
||||
'change_default', 'translate', 'help', 'select', 'selectable'):
|
||||
if getattr(self._columns[f], arg):
|
||||
res[f][arg] = getattr(self._columns[f], arg)
|
||||
if not read_access:
|
||||
@@ -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
|
||||
@@ -2903,6 +2904,7 @@ class orm(orm_template):
|
||||
:raise UserError: if the record is default property for other records
|
||||
|
||||
"""
|
||||
|
||||
if not ids:
|
||||
return True
|
||||
if isinstance(ids, (int, long)):
|
||||
@@ -2954,9 +2956,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 +3166,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 +3533,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 +3603,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 +3623,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 +3650,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 +3732,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 +3757,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
|
||||
"""
|
||||
|
||||
@@ -27,19 +27,24 @@ from report import render
|
||||
import locale
|
||||
|
||||
import time, os
|
||||
from operator import itemgetter
|
||||
from datetime import datetime
|
||||
|
||||
class report_printscreen_list(report_int):
|
||||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
self.context = {}
|
||||
self.groupby = []
|
||||
|
||||
def _parse_node(self, root_node):
|
||||
result = []
|
||||
for node in root_node:
|
||||
field_name = node.get('name')
|
||||
if not eval(str(node.attrib.get('invisible',False)),{'context':self.context}):
|
||||
if node.tag == 'field':
|
||||
result.append(node.get('name'))
|
||||
if field_name in self.groupby:
|
||||
continue
|
||||
result.append(field_name)
|
||||
else:
|
||||
result.extend(self._parse_node(node))
|
||||
return result
|
||||
@@ -55,6 +60,7 @@ class report_printscreen_list(report_int):
|
||||
if not context:
|
||||
context={}
|
||||
self.context = context
|
||||
self.groupby = context.get('group_by',[])
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
model = pool.get(datas['model'])
|
||||
model_id = pool.get('ir.model').search(cr, uid, [('model','=',model._name)])
|
||||
@@ -64,35 +70,37 @@ class report_printscreen_list(report_int):
|
||||
else:
|
||||
model_desc = model._description
|
||||
self.title = model_desc
|
||||
|
||||
datas['ids'] = ids
|
||||
model = pooler.get_pool(cr.dbname).get(datas['model'])
|
||||
result = model.fields_view_get(cr, uid, view_type='tree', context=context)
|
||||
fields_order = self._parse_string(result['arch'])
|
||||
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context)
|
||||
ids2 = [x['id'] for x in rows] # getting the ids from read result
|
||||
if datas['ids'] != ids2: # sorted ids were not taken into consideration for print screen
|
||||
rows_new = []
|
||||
for id in datas['ids']:
|
||||
element = [elem for elem in rows if elem['id']==id]
|
||||
rows_new.append(element[0])
|
||||
rows = rows_new
|
||||
if context.get('group_by',False):
|
||||
if context['group_by'] in fields_order:
|
||||
fields_order.remove(context['group_by'])
|
||||
fields_order.insert(0, context['group_by'])
|
||||
re = model.read_group(cr, uid, [('id','in',ids)], fields_order, context.get('group_by',False),0,None,context)
|
||||
rows=[]
|
||||
for r in re:
|
||||
for f in fields_order:
|
||||
if f not in r:
|
||||
r.update({f:False})
|
||||
r['__group']=True
|
||||
rows.append(r)
|
||||
_ids = model.search(cr, uid, r['__domain'])
|
||||
res=model.read(cr, uid, _ids, result['fields'].keys(), context)
|
||||
for r in res:
|
||||
rows.append(r)
|
||||
fields_order = self.groupby + self._parse_string(result['arch'])
|
||||
if self.groupby:
|
||||
rows = []
|
||||
def get_groupby_data(groupby = [], domain = []):
|
||||
records = model.read_group(cr, uid, domain, fields_order, groupby , 0, None, context)
|
||||
for rec in records:
|
||||
rec['__group'] = True
|
||||
for f in fields_order:
|
||||
if f not in rec:
|
||||
rec.update({f:False})
|
||||
rows.append(rec)
|
||||
groupby = (rec.get('__context', {})).get('group_by',[])
|
||||
domain = rec.get('__domain', [])
|
||||
if groupby:
|
||||
get_groupby_data(groupby, domain)
|
||||
else:
|
||||
child_ids = model.search(cr, uid, domain)
|
||||
res = model.read(cr, uid, child_ids, result['fields'].keys(), context)
|
||||
rows.extend(res)
|
||||
get_groupby_data(self.groupby, [('id','in',ids)])
|
||||
else:
|
||||
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context)
|
||||
ids2 = map(itemgetter('id'), rows) # getting the ids from read result
|
||||
if datas['ids'] != ids2: # sorted ids were not taken into consideration for print screen
|
||||
rows_new = []
|
||||
for id in datas['ids']:
|
||||
rows_new += [elem for elem in rows if elem['id'] == id]
|
||||
rows = rows_new
|
||||
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
|
||||
return (self.obj.get(), 'pdf')
|
||||
|
||||
@@ -116,13 +124,14 @@ class report_printscreen_list(report_int):
|
||||
|
||||
l = []
|
||||
t = 0
|
||||
rowcount=0;
|
||||
rowcount = 0;
|
||||
strmax = (pageSize[0]-40) * 2.8346
|
||||
temp = []
|
||||
tsum = []
|
||||
count = len(fields_order)
|
||||
for i in range(0, count):
|
||||
temp.append(0)
|
||||
|
||||
tsum.append(0)
|
||||
ince = -1;
|
||||
for f in fields_order:
|
||||
s = 0
|
||||
@@ -131,7 +140,7 @@ class report_printscreen_list(report_int):
|
||||
s = 60
|
||||
strmax -= s
|
||||
if fields[f]['type'] in ('float','integer'):
|
||||
temp[ince]=1;
|
||||
temp[ince] = 1
|
||||
else:
|
||||
t += fields[f].get('size', 80) / 28 + 1
|
||||
|
||||
@@ -149,10 +158,6 @@ class report_printscreen_list(report_int):
|
||||
field.text = tools.ustr(fields[f]['string'] or '')
|
||||
|
||||
lines = etree.SubElement(new_doc, 'lines')
|
||||
tsum = []
|
||||
count = len(fields_order)
|
||||
for i in range(0,count):
|
||||
tsum.append(0)
|
||||
for line in results:
|
||||
node_line = etree.SubElement(lines, 'row')
|
||||
count = -1
|
||||
@@ -212,9 +217,8 @@ class report_printscreen_list(report_int):
|
||||
tsum[count] = float(tsum[count]) + float(line[f]);
|
||||
else:
|
||||
col.text = '/'
|
||||
|
||||
node_line = etree.SubElement(lines, 'row')
|
||||
for f in range(0,count+1):
|
||||
for f in range(0, count+1):
|
||||
col = etree.SubElement(node_line, 'col', para='group', tree='no')
|
||||
if tsum[f] != None:
|
||||
if tsum[f] >= 0.01 :
|
||||
|
||||
+13
-11
@@ -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('<image')<0) and rml_head.find('<!--image')<0:
|
||||
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="70" width="90" >[[company.logo]] </image> ''')
|
||||
if not self.logo and rml_head.find('company.logo')>=0:
|
||||
rml_head = rml_head.replace('<image','<!--image')
|
||||
rml_head = rml_head.replace('</image>','</image-->')
|
||||
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user