Merge lp:~openerp.vn/openobject-jasper-reports/6.1 into lp:openobject-jasper-reports/6.1

Proposed by Huy Doan
Status: Merged
Merged at revision: 180
Proposed branch: lp:~openerp.vn/openobject-jasper-reports/6.1
Merge into: lp:openobject-jasper-reports/6.1
Diff against target: 215 lines (+76/-90)
6 files modified
jasper_reports/__openerp__.py (+2/-1)
jasper_reports/jasper_wizard.xml (+4/-7)
jasper_reports/wizard/__init__.py (+1/-1)
jasper_reports/wizard/create_data_template.py (+0/-81)
jasper_reports/wizard/jasper_create_data_template.py (+33/-0)
jasper_reports/wizard/jasper_create_data_template.xml (+36/-0)
To merge this branch: bzr merge lp:~openerp.vn/openobject-jasper-reports/6.1
Reviewer Review Type Date Requested Status
Omar (Pexego) Approve
Review via email: mp+104103@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Omar (Pexego) (omar7r) wrote :

Merged, I did a small fix in return statement to works in gtk client too.

Thank you

Revision history for this message
Omar (Pexego) (omar7r) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jasper_reports/__openerp__.py'
2--- jasper_reports/__openerp__.py 2012-03-05 19:10:36 +0000
3+++ jasper_reports/__openerp__.py 2012-04-30 12:59:17 +0000
4@@ -28,7 +28,7 @@
5
6 {
7 "name" : "Jasper Reports",
8- "version" : "0.1",
9+ "version" : "0.1.1",
10 "description" : "This module integrates Jasper Reports with OpenERP.",
11 "author" : "NaN┬Ětic",
12 "website" : "http://www.nan-tic.com",
13@@ -39,6 +39,7 @@
14 'jasper_demo.xml'
15 ],
16 "update_xml" : [
17+ 'wizard/jasper_create_data_template.xml',
18 'jasper_wizard.xml',
19 'report_xml_view.xml',
20 'security/ir.model.access.csv',
21
22=== modified file 'jasper_reports/jasper_wizard.xml'
23--- jasper_reports/jasper_wizard.xml 2009-08-29 22:32:12 +0000
24+++ jasper_reports/jasper_wizard.xml 2012-04-30 12:59:17 +0000
25@@ -1,13 +1,10 @@
26 <?xml version="1.0"?>
27 <openerp>
28 <data>
29- <record model="ir.actions.wizard" id="jasper_create_data_template_action">
30- <field name="name">Create Data Template</field>
31- <field name="wiz_name">jasper_create_data_template</field>
32- </record>
33 <menuitem parent="base.menu_custom" name="Jasper Reports" id="jasper_reports_menu"/>
34- <menuitem parent="jasper_reports_menu"
35- action="jasper_create_data_template_action" id="jasper_create_data_template_menu"
36- type="wizard"/>
37+ <menuitem
38+ parent="jasper_reports_menu"
39+ action="action_jasper_create_date_template"
40+ id="jasper_create_data_template_menu" sequence="1" />
41 </data>
42 </openerp>
43
44=== modified file 'jasper_reports/wizard/__init__.py'
45--- jasper_reports/wizard/__init__.py 2009-01-03 20:36:32 +0000
46+++ jasper_reports/wizard/__init__.py 2012-04-30 12:59:17 +0000
47@@ -1,1 +1,1 @@
48-import create_data_template
49+import jasper_create_data_template
50
51=== removed file 'jasper_reports/wizard/create_data_template.py'
52--- jasper_reports/wizard/create_data_template.py 2011-06-13 15:17:43 +0000
53+++ jasper_reports/wizard/create_data_template.py 1970-01-01 00:00:00 +0000
54@@ -1,81 +0,0 @@
55-# encoding: iso-8859-15
56-import wizard
57-import pooler
58-import base64
59-import osv
60-from tools.translate import _
61-
62-view_form_start = """<?xml version="1.0"?>
63- <form string="Create Data Template">
64- <group colspan="2">
65- <field name="model"/>
66- <field name="depth"/>
67- </group>
68- </form>"""
69-
70-view_fields_start = {
71- 'model': { 'string': 'Model', 'type': 'many2one', 'relation': 'ir.model', 'required': True },
72- 'depth': { 'string':'Depth', 'type':'integer', 'required': True },
73-}
74-
75-view_form_end = """<?xml version="1.0"?>
76- <form string="Create Data Template">
77- <group colspan="2">
78- <field name="model"/>
79- <field name="data" filename="filename"/>
80- <field name="filename" invisible="1"/>
81- </group>
82- </form>"""
83-
84-view_fields_end = {
85- 'model': { 'string': 'Model', 'type': 'char', 'readonly': True },
86- 'data': { 'string': 'XML', 'type': 'binary', 'relation': 'ir.model', 'readonly': True },
87- 'filename': { 'string': 'File Name', 'type': 'char' },
88-}
89-
90-class create_data_template(wizard.interface):
91-
92- def _action_start(self, cr, uid, data, context):
93- res = {
94- 'depth': 1
95- }
96- return res
97-
98- def _action_create_xml(self, cr, uid, data, context):
99- pool = pooler.get_pool(cr.dbname)
100- form = data['form']
101- values = pool.get('ir.model').read(cr, uid, form['model'], ['name','model'], context)
102- name = values['name']
103- model = values['model']
104-
105-
106- xml = pool.get('ir.actions.report.xml').create_xml(cr, uid, model, form['depth'], context)
107-
108- return {
109- 'model': name,
110- 'data': base64.encodestring( xml ),
111- 'filename': 'jasper.xml',
112- }
113-
114- states = {
115- 'init': {
116- 'actions': [_action_start],
117- 'result': {
118- 'type': 'form',
119- 'arch': view_form_start,
120- 'fields': view_fields_start,
121- 'state': [('end','Cancel','gtk-cancel'),('create','Create','gtk-ok')]
122- }
123- },
124- 'create': {
125- 'actions': [_action_create_xml],
126- 'result': {
127- 'type': 'form',
128- 'arch': view_form_end,
129- 'fields': view_fields_end,
130- 'state': [('end','Accept','gtk-ok')]
131- }
132- }
133- }
134-
135-create_data_template('jasper_create_data_template')
136
137=== added file 'jasper_reports/wizard/jasper_create_data_template.py'
138--- jasper_reports/wizard/jasper_create_data_template.py 1970-01-01 00:00:00 +0000
139+++ jasper_reports/wizard/jasper_create_data_template.py 2012-04-30 12:59:17 +0000
140@@ -0,0 +1,33 @@
141+import wizard
142+import pooler
143+import base64
144+from osv import osv,fields
145+from tools.translate import _
146+
147+class create_data_template(osv.osv_memory):
148+ _name = 'jasper.create.data.template'
149+ _description = 'Create data template'
150+
151+ def action_create_xml(self, cr, uid, ids, context=None):
152+ for data in self.read(cr, uid, ids, context=context):
153+ model = self.pool.get('ir.model').browse(cr, uid, data['model'][0], context=context)
154+ xml = self.pool.get('ir.actions.report.xml').create_xml(cr, uid, model.model, data['depth'], context)
155+ self.write(cr,uid,ids,{
156+ 'data' : base64.encodestring( xml ),
157+ 'filename': 'template.xml'
158+ })
159+ return {
160+ 'type': ''
161+ }
162+
163+ _columns = {
164+ 'model': fields.many2one('ir.model', 'Model', required=True),
165+ 'depth': fields.integer("Depth", required=True),
166+ 'filename': fields.char('File Name', size=32),
167+ 'data': fields.binary('XML')
168+ }
169+
170+ _defaults = {
171+ 'depth': 1
172+ }
173+create_data_template()
174
175=== added file 'jasper_reports/wizard/jasper_create_data_template.xml'
176--- jasper_reports/wizard/jasper_create_data_template.xml 1970-01-01 00:00:00 +0000
177+++ jasper_reports/wizard/jasper_create_data_template.xml 2012-04-30 12:59:17 +0000
178@@ -0,0 +1,36 @@
179+<?xml version="1.0" encoding="utf-8"?>
180+<openerp>
181+ <data>
182+ <record id="view_pos_box_out" model="ir.ui.view">
183+ <field name="name">Create Data Template</field>
184+ <field name="model">jasper.create.data.template</field>
185+ <field name="type">form</field>
186+ <field name="arch" type="xml">
187+ <form string="Create Data Template">
188+ <group colspan="2">
189+ <field name="model"/>
190+ <field name="depth"/>
191+ <field name="data" filename="filename" readonly="1" />
192+ <field name="filename" invisible="1"/>
193+ </group>
194+ <group colspan="4" col="4">
195+ <group col="2" colspan="2"/>
196+ <button name="action_create_xml" string="Create"
197+ colspan="1" type="object" icon="gtk-apply" />
198+ <button icon="gtk-stop" special="cancel"
199+ string="Close" />
200+ </group>
201+ </form>
202+ </field>
203+ </record>
204+
205+ <record id="action_jasper_create_date_template" model="ir.actions.act_window">
206+ <field name="name">Create Data Template</field>
207+ <field name="type">ir.actions.act_window</field>
208+ <field name="res_model">jasper.create.data.template</field>
209+ <field name="view_type">form</field>
210+ <field name="view_mode">form</field>
211+ <field name="target">new</field>
212+ </record>
213+ </data>
214+</openerp>
215\ No newline at end of file