Don't load the sxw by default in the DB

- New field function that return the content of the report that comes from
 the DB if it exist otherwise take it in the filesystem.
- In report, use the object insteaf of sql query -> can change the report depending of the context :-)
- Remove previous sxw tag in the xml files. This tag must no more used.

bzr revid: ced-b471dc744a247c6098cb0d63db272d675096f802
This commit is contained in:
ced 2007-09-07 14:02:45 +00:00
parent 65985ac3d1
commit f3ae07b425
4 changed files with 58 additions and 55 deletions

View File

@ -59,14 +59,12 @@
model="res.partner"
name="account.overdue"
rml="account/report/overdue.rml"
sxw="account/report/overdue.sxw"
auto="False" />
<report id="account_invoices"
string="Invoices"
model="account.invoice"
name="account.invoice"
rml="account/report/invoice.rml"
sxw="account/report/invoice.sxw"
auto="False"/>
<report id="account_transfers"
string="Transfers"

View File

@ -1,6 +1,6 @@
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Copyright (c) 2005-2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@ -41,9 +41,9 @@ intro_form = '''<?xml version="1.0"?>
intro_fields = {
'text': {
'string':'Introduction',
'type':'text',
'readonly':True,
'string': 'Introduction',
'type': 'text',
'readonly': True,
'default': lambda *args: """This system must be used with the Tiny OpenOffice plugin. If you
did not installed yet, you can find this package on:
http://tinyerp.com
@ -53,12 +53,15 @@ in OpenOffice. After having modified it, you will be able to reupload
it to the Tiny ERP server.
"""},
'operation': {
'string':'Operation',
'type':'selection',
'selection':[('create','Create a new report'),('modify','Modify an existing report')],
'size':32,
'required':True,
'default':lambda *args: 'create'
'string': 'Operation',
'type': 'selection',
'selection': [
('create','Create a new report'),
('modify','Modify an existing report')
],
'size': 32,
'required': True,
'default': lambda *args: 'create',
},
}
@ -70,11 +73,11 @@ get_form = '''<?xml version="1.0"?>
get_fields = {
'report_id': {
'string':'Report',
'type':'many2one',
'relation':'ir.actions.report.xml',
'required':True,
'domain': [('report_sxw_content','<>',False)]
'string': 'Report',
'type': 'many2one',
'relation': 'ir.actions.report.xml',
'required': True,
'domain': [('report_sxw_content','<>',False)],
},
}
@ -90,15 +93,15 @@ get_form_result = '''<?xml version="1.0"?>
get_form_fields = {
'report_id': {
'string':'Report',
'type':'many2one',
'relation':'ir.actions.report.xml',
'readonly':True,
'string': 'Report',
'type': 'many2one',
'relation': 'ir.actions.report.xml',
'readonly': True,
},
'file_sxw': {
'string':'Your .SXW file',
'type':'binary',
'readonly':True
'string': 'Your .SXW file',
'type': 'binary',
'readonly': True,
}
}
@ -123,19 +126,22 @@ send_form_arch = '''<?xml version="1.0"?>
send_form_fields = {
'report_id': {
'string':'Report',
'type':'many2one',
'relation':'ir.actions.report.xml',
'required':True,
'string': 'Report',
'type': 'many2one',
'relation': 'ir.actions.report.xml',
'required': True,
'domain': [('report_sxw_content','<>',False)]
},
'file_sxw': {
'string':'Your .SXW file',
'type':'binary',
'required':True
'string': 'Your .SXW file',
'type': 'binary',
'required': True
}
}
def _get_default(obj, cursor, user, data, context):
return {'report_id': data['id']}
class base_report_designer_modify(wizard.interface):
def _upload_report_clear(self, cr, uid, data, context):
@ -160,24 +166,24 @@ class base_report_designer_modify(wizard.interface):
states = {
'init': {
'actions': [],
'actions': [],
'result': {
'type':'form',
'arch':intro_form,
'fields':intro_fields,
'state':[
'type': 'form',
'arch': intro_form,
'fields': intro_fields,
'state': [
('end','Cancel'),
('get_form','Modify a report')
]
}
},
'get_form': {
'actions': [],
'actions': [_get_default],
'result': {
'type':'form',
'arch':get_form,
'fields':get_fields,
'state':[
'type': 'form',
'arch': get_form,
'fields': get_fields,
'state': [
('end','Cancel'),
('get_form_result', 'Continue'),
]
@ -186,10 +192,10 @@ class base_report_designer_modify(wizard.interface):
'get_form_result': {
'actions': [_get_report],
'result': {
'type':'form',
'arch':get_form_result,
'fields':get_form_fields,
'state':[
'type': 'form',
'arch': get_form_result,
'fields': get_form_fields,
'state': [
('end','Close'),
('send_form', 'Upload the modified report'),
]
@ -198,10 +204,10 @@ class base_report_designer_modify(wizard.interface):
'send_form': {
'actions': [_upload_report_clear],
'result': {
'type':'form',
'arch':send_form_arch,
'fields':send_form_fields,
'state':[
'type': 'form',
'arch': send_form_arch,
'fields': send_form_fields,
'state': [
('end','Close'),
('send_form_result', 'Update the report'),
]
@ -210,14 +216,15 @@ class base_report_designer_modify(wizard.interface):
'send_form_result': {
'actions': [_upload_report],
'result': {
'type':'form',
'arch':send_form_result_arch,
'fields':send_form_result_fields,
'state':[
'type': 'form',
'arch': send_form_result_arch,
'fields': send_form_result_fields,
'state': [
('end','Close'),
]
}
},
}
base_report_designer_modify('base_report_designer.modify')

View File

@ -6,7 +6,6 @@
string="Request for Quotation"
model="purchase.order"
rml="purchase/report/request_quotation.rml"
sxw="purchase/report/request_quotation.sxw"
auto="False"/>
<report id="report_purchase_order"
name="purchase.order"

View File

@ -6,7 +6,6 @@
model="report_account_analytic.planning"
name="report_account_analytic.planning.print"
rml="report_analytic_planning/report/report_planning.rml"
sxw="report_analytic_planning/report/report_planning.sxw"
/>
</data>
</terp>