From f3ae07b425832cee3547f0bb1c1883e341eb7151 Mon Sep 17 00:00:00 2001 From: ced <> Date: Fri, 7 Sep 2007 14:02:45 +0000 Subject: [PATCH] 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 --- addons/account/account_report.xml | 2 - .../wizard/base_report_designer_modify.py | 109 ++++++++++-------- addons/purchase/purchase_report.xml | 1 - .../report_analytic_planning_report.xml | 1 - 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 86913f6e920..1c596975d24 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -59,14 +59,12 @@ model="res.partner" name="account.overdue" rml="account/report/overdue.rml" - sxw="account/report/overdue.sxw" auto="False" /> 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 = ''' 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 = ''' 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 = ''' 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') diff --git a/addons/purchase/purchase_report.xml b/addons/purchase/purchase_report.xml index d9fe12489b3..fae439191bf 100644 --- a/addons/purchase/purchase_report.xml +++ b/addons/purchase/purchase_report.xml @@ -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"/>