lims_report_html: allow to disable result report templates
This commit is contained in:
parent
0b85b34c7a
commit
a6a603d635
|
@ -14,6 +14,8 @@ class Analysis(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
],
|
||||
states={'readonly': Eval('type') != 'group'},
|
||||
depends=['type'])
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
|
@ -13,4 +14,6 @@ class Configuration(metaclass=PoolMeta):
|
|||
'Default Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
])
|
||||
|
|
|
@ -18,7 +18,7 @@ from babel.support import Translations as BabelTranslations
|
|||
from mimetypes import guess_type as mime_guess_type
|
||||
from sql import Literal
|
||||
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.model import ModelSQL, ModelView, DeactivableMixin, fields
|
||||
from trytond.report import Report
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Bool, Or
|
||||
|
@ -31,7 +31,7 @@ from trytond import backend
|
|||
from .generator import PdfGenerator
|
||||
|
||||
|
||||
class ReportTemplate(ModelSQL, ModelView):
|
||||
class ReportTemplate(DeactivableMixin, ModelSQL, ModelView):
|
||||
'Report Template'
|
||||
__name__ = 'lims.report.template'
|
||||
|
||||
|
@ -59,12 +59,16 @@ class ReportTemplate(ModelSQL, ModelView):
|
|||
domain=[
|
||||
('report_name', '=', Eval('report_name')),
|
||||
('type', '=', 'header'),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('header'))],
|
||||
],
|
||||
depends=['report_name'])
|
||||
footer = fields.Many2One('lims.report.template', 'Footer',
|
||||
domain=[
|
||||
('report_name', '=', Eval('report_name')),
|
||||
('type', '=', 'footer'),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('footer'))],
|
||||
],
|
||||
depends=['report_name'])
|
||||
translations = fields.One2Many('lims.report.template.translation',
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class Laboratory(metaclass=PoolMeta):
|
||||
|
@ -13,4 +14,6 @@ class Laboratory(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
])
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class Party(metaclass=PoolMeta):
|
||||
|
@ -13,4 +14,6 @@ class Party(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
])
|
||||
|
|
|
@ -21,6 +21,8 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('template'))],
|
||||
],
|
||||
states={'readonly': Eval('state') != 'draft'},
|
||||
depends=['state'])
|
||||
|
@ -495,6 +497,8 @@ class GenerateReportStart(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('template'))],
|
||||
],
|
||||
states={'readonly': Bool(Eval('report'))},
|
||||
depends=['report'])
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class Fraction(metaclass=PoolMeta):
|
||||
|
@ -36,6 +37,8 @@ class Sample(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
])
|
||||
resultrange_origin = fields.Many2One('lims.range.type', 'Comparison range',
|
||||
domain=[('use', '=', 'result_range')])
|
||||
|
@ -54,6 +57,8 @@ class CreateSampleStart(metaclass=PoolMeta):
|
|||
'Report Template', domain=[
|
||||
('report_name', '=', 'lims.result_report'),
|
||||
('type', 'in', [None, 'base']),
|
||||
['OR', ('active', '=', True),
|
||||
('id', '=', Eval('result_template'))],
|
||||
])
|
||||
resultrange_origin = fields.Many2One('lims.range.type', 'Comparison range',
|
||||
domain=[('use', '=', 'result_range')])
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
<field name="page_orientation"/>
|
||||
<label name="resultrange_origin"/>
|
||||
<field name="resultrange_origin"/>
|
||||
<label name="active"/>
|
||||
<field name="active" xexpand="0" width="25"/>
|
||||
<notebook>
|
||||
<page name="content">
|
||||
<field name="content" colspan="4" widget="html"/>
|
||||
|
|
Loading…
Reference in New Issue