Merge lp:~syleam/openobject-addons/trunk-base-report-creator into lp:~openerp/openobject-addons/old_trunk

Proposed by Christophe CHAUVET
Status: Merged
Merge reported by: Husen Daudi
Merged at revision: not available
Proposed branch: lp:~syleam/openobject-addons/trunk-base-report-creator
Merge into: lp:~openerp/openobject-addons/old_trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~syleam/openobject-addons/trunk-base-report-creator
Reviewer Review Type Date Requested Status
Husen Daudi (community) Approve
Review via email: mp+4704@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Correct bug #345643
Improve to permit user to see only his affect objects

Maybe apply on 5.0 ?

Revision history for this message
Husen Daudi (husendaudi) wrote :

Applied changes with this bug post 345643.

Did not apply changes on base_report_creator/wizard/wiz_set_filter_fields.py
Because following code will generate error while search_value is not iterable.
if len(search_value) > 1:

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_report_creator/base_report_creator.py'
2--- base_report_creator/base_report_creator.py 2009-03-06 23:50:10 +0000
3+++ base_report_creator/base_report_creator.py 2009-03-20 09:50:13 +0000
4@@ -233,7 +233,7 @@
5 ret_str = ret_str[0:len(ret_str)-3]
6 if ret_str.endswith('or'):
7 ret_str = ret_str[0:len(ret_str)-2]
8- return ret_str
9+ return ret_str % {'uid': uid}
10
11 def _id_get(self, cr, uid, id, context):
12 # return 'min(sale_order_line.id)'
13
14=== modified file 'base_report_creator/base_report_creator_view.xml'
15--- base_report_creator/base_report_creator_view.xml 2008-11-21 08:46:40 +0000
16+++ base_report_creator/base_report_creator_view.xml 2009-03-20 09:50:13 +0000
17@@ -86,6 +86,8 @@
18 <field name="condition"/>
19 </form>
20 </field>
21+ <separator string="Legend" colspan="4"/>
22+ <label string="Use %%(uid)s to filter by the connect user" align="0.0"/>
23 </page><page string="Security">
24 <separator string="Authorized Groups (empty for all)" colspan="4"/>
25 <field name="group_ids" colspan="4" nolabel="1"/>
26
27=== modified file 'base_report_creator/wizard/wiz_set_filter_fields.py'
28--- base_report_creator/wizard/wiz_set_filter_fields.py 2009-01-18 12:52:45 +0000
29+++ base_report_creator/wizard/wiz_set_filter_fields.py 2009-03-20 09:50:13 +0000
30@@ -69,28 +69,30 @@
31 field_search = [field_name,search_operator,search_value]
32 if search_operator == '=':
33 if field_type=='many2one':
34- field_search[1]='in'
35- field_search[2] = "("+','.join([str(x) for x in search_value])+")"
36+ if len(search_value) > 1:
37+ field_search[1]='in'
38+ field_search[2] = "("+','.join([str(x) for x in search_value])+")"
39+ else:
40+ field_search[1]='='
41+ field_search[2] = str(search_value[0])
42 elif field_type in char_type or field_type in date_type:
43 field_search[2] = "'"+field_search[2]+"'"
44 elif search_operator == '<>':
45 if field_type=='many2one':
46- field_search[1]='not in'
47- field_search[2] = "("+','.join([str(x) for x in search_value])+")"
48+ if len(search_value) > 1:
49+ field_search[1]='not in'
50+ field_search[2] = "("+','.join([str(x) for x in search_value])+")"
51+ else:
52+ field_search[1]='<>'
53+ field_search[2] = str(search_value[0])
54 elif field_type in char_type or field_type in date_type:
55 field_search[2] = "'"+field_search[2]+"'"
56 elif search_operator == 'in':
57- if field_type=='many2one':
58- field_search[2] = "("+','.join([str(x) for x in search_value])+")"
59- else:
60- field_search[1] = 'ilike'
61- field_search[2] = "'%"+str(search_value)+"%'"
62+ field_search[1] = 'ilike'
63+ field_search[2] = "'%"+str(search_value)+"%'"
64 elif search_operator == 'not in':
65- if field_type=='many2one':
66- field_search[2] = "("+','.join([str(x) for x in search_value])+")"
67- else:
68- field_search[1] = 'not ilike'
69- field_search[2] = "'%"+str(search_value)+"%'"
70+ field_search[1] = 'not ilike'
71+ field_search[2] = "'%"+str(search_value)+"%'"
72 elif search_operator == '^':
73 if field_type in char_type:
74 field_search[1]='~'
75@@ -112,6 +114,7 @@
76 elif field_type not in int_type:
77 return False
78 return field_search
79+
80 def _set_filter_value(self, cr, uid, data, context):
81 form_data = data['form']
82 value_data = form_data.get('value',False)
83@@ -171,9 +174,8 @@
84 operator.pop(operator.__len__()-1)
85
86 if field.ttype == 'many2one':
87- operator.append(('in','Equals'))
88- operator.append(('in','Contains'))
89- operator.append(('not in','Not Contains'))
90+ operator.append(('=','Equals'))
91+ operator.append(('<>','Not Equals'))
92 operator.append(('is','Is Empty'))
93 operator.append(('is not','Is Not Empty'))
94 elif field.ttype in ('char', 'text'):