Fix copy of action report

- don't copy data in the DB if there is a path
- add constraint unique on report_name
- add report_content in the view
This commit is contained in:
Cédric Krier committed 2008-02-08 18:38:10 +01:00
1 parent 3b056b98f0
commit 3262890fbd
2 files changed
+17 -1

No files matched your search

+14
View File
@@ -154,6 +154,20 @@ class ActionReport(OSV):
'type': lambda *a: 'ir.action.report',
'report_content': lambda *a: False,
}
_sql_constraints = [
('report_name_uniq', 'unique (report_name)',
'The internal name must be unique!'),
]
def copy(self, cursor, user, object_id, default=None, context=None):
if default is None:
default = {}
report = self.browse(cursor, user, object_id, context=context)
if report.report:
default['report_content'] = False
default['report_name'] = report.report_name + '.copy'
return super(ActionReport, self).copy(cursor, user, object_id,
default=default, context=context)
ActionReport()
+3 -1
View File
@@ -62,7 +62,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<![CDATA[
<form string="Report" col="8">
<form string="Report" col="6">
<label name="name"/>
<field name="name"/>
<label name="model"/>
@@ -71,6 +71,8 @@
<field name="report_name"/>
<label name="report"/>
<field name="report"/>
<label name="report_content"/>
<field name="report_content"/>
<field name="keywords" colspan="8">
<tree string="Keywords">
<field name="keyword"/>