bzr revid: fp@tinyerp.com-20090513222533-r7eotjdxglz4opzi
This commit is contained in:
Fabien Pinckaers
2009-05-14 00:25:33 +02:00
4 changed files with 30 additions and 10 deletions
+5 -4
View File
@@ -254,12 +254,13 @@ class expression(object):
query = '(%s OR %s IS NULL)' % (query, left)
else:
params = []
if right == False and table._columns[leaf[0]]._type=="boolean" and (operator == '='):
query = '%s.%s IS NULL or %s.%s = false ' % (table._table, left,table._table, left)
if right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator == '='):
query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left,table._table, left)
elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
query = '%s.%s IS NULL ' % (table._table, left)
elif right == False and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
query = '%s.%s IS NOT NULL and %s.%s != false' % (table._table, left,table._table, left)
elif right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
query = '%s.%s IS NOT NULL' % (table._table, left)
else:
+9 -1
View File
@@ -2405,7 +2405,15 @@ class orm(orm_template):
upd0 += ','+self._inherits[table]
upd1 += ',%s'
upd2.append(id)
#Start : Set bool fields to be False if they are not touched(to make search more powerful)
bool_fields = [x for x in self._columns.keys() if self._columns[x]._type=='boolean']
for bool_field in bool_fields:
if bool_field not in vals:
vals[bool_field] = False
#End
for field in vals:
if self._columns[field]._classic_write:
upd0 = upd0 + ',"' + field + '"'
+13 -1
View File
@@ -40,6 +40,7 @@
import re
import reportlab
from lxml import etree
import copy
_regex = re.compile('\[\[(.+?)\]\]')
@@ -47,6 +48,7 @@ def _child_get(node, self=None, tagname=None):
for n in node:
if self and self.localcontext and n.get('rml_loop', False):
oldctx = self.localcontext
for ctx in eval(n.get('rml_loop'),{}, self.localcontext):
self.localcontext.update(ctx)
if (tagname is None) or (n.tag==tagname):
@@ -58,7 +60,7 @@ def _child_get(node, self=None, tagname=None):
if n.get('rml_tag'):
try:
(tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext)
n2 = copy.copy(n)
n2 = copy.deepcopy(n)
n2.tag = tag
n2.attrib.update(attr)
yield n2
@@ -73,6 +75,16 @@ def _child_get(node, self=None, tagname=None):
eval(n.get('rml_except'), {}, self.localcontext)
except:
continue
if self and self.localcontext and n.get('rml_tag', False):
try:
(tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext)
n2 = copy.deepcopy(n)
n2.tag = tag
n2.attrib.update(attr)
yield n2
tagname = ''
except:
pass
if (tagname is None) or (n.tag==tagname):
yield n
+3 -4
View File
@@ -495,16 +495,16 @@ class report_sxw(report_rml, preprocess.report):
final_op = sxw_io.getvalue()
sxw_io.close()
return (final_op, report_type)
def create_single_html2html(self, cr, uid, ids, data, report_xml, context={}):
context = context.copy()
report_type = 'html'
context['parents'] = html_parents
html = report_xml.report_rml_content
html_parser = self.parser(cr, uid, self.name2, context)
html_parser.parents = html_parents
html_parser.tag = sxw_tag
html_parser.tag = sxw_tag
objs = self.getObjects(cr, uid, ids, context)
html_parser.set_context(objs, data, ids, report_type)
@@ -515,6 +515,5 @@ class report_sxw(report_rml, preprocess.report):
html = etree.tostring(create_doc(html_dom, html_parser.localcontext))
return (html.replace('&lt;', '<').replace('&gt;', '>').replace('</br>',''), report_type)