Hide report path if custom template is set

This gives visual hint to the user about customization.

issue6064
review25831002
This commit is contained in:
Cédric Krier committed 2016-12-13 18:31:42 +01:00
1 parent 1029de47c6
commit 015603c847
2 files changed
+13 -4

No files matched your search

+11 -2
View File
@@ -12,7 +12,7 @@ from sql.aggregate import Count
from ..model import ModelView, ModelStorage, ModelSQL, fields
from ..tools import file_open
from .. import backend
from ..pyson import PYSONDecoder, PYSON
from ..pyson import PYSONDecoder, PYSON, Eval
from ..transaction import Transaction
from ..pool import Pool
from ..cache import Cache
@@ -392,8 +392,14 @@ class ActionReport(ActionMixin, ModelSQL, ModelView):
_action_name = 'report_name'
model = fields.Char('Model')
report_name = fields.Char('Internal Name', required=True)
report = fields.Char('Path')
report = fields.Char(
"Path",
states={
'invisible': Eval('is_custom', False),
},
depends=['is_custom'])
report_content_custom = fields.Binary('Content')
is_custom = fields.Function(fields.Boolean("Is Custom"), 'get_is_custom')
report_content = fields.Function(fields.Binary('Content',
filename='report_content_name'),
'get_report_content', setter='set_report_content')
@@ -603,6 +609,9 @@ class ActionReport(ActionMixin, ModelSQL, ModelView):
else:
cls.raise_user_error('invalid_email', (report.rec_name,))
def get_is_custom(self, name):
return bool(self.report_content_custom)
@classmethod
def get_report_content(cls, reports, name):
contents = {}
+2 -2
View File
@@ -15,10 +15,10 @@ this repository contains the full copyright notices and license terms. -->
<label name="icon"/>
<field name="icon"/>
<newline/>
<label name="report"/>
<field name="report"/>
<label name="report_content"/>
<field name="report_content"/>
<label name="report"/>
<field name="report"/>
<label name="template_extension"/>
<field name="template_extension"/>
<label name="extension"/>