lims_report_html/lims_diagnosis: associate report template to analysis group
This commit is contained in:
parent
e3e1d46a3c
commit
aacb4ae4e0
|
@ -320,10 +320,6 @@ msgctxt "selection:lims.results_report.version.detail,state:"
|
||||||
msgid "Diagnosed"
|
msgid "Diagnosed"
|
||||||
msgstr "Diagnosticado"
|
msgstr "Diagnosticado"
|
||||||
|
|
||||||
msgctxt "view:lims.analysis:"
|
|
||||||
msgid "Diagnosis"
|
|
||||||
msgstr "Diagnóstico"
|
|
||||||
|
|
||||||
msgctxt "view:lims.diagnosis.state:"
|
msgctxt "view:lims.diagnosis.state:"
|
||||||
msgid "Options"
|
msgid "Options"
|
||||||
msgstr "Opciones"
|
msgstr "Opciones"
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="/form/notebook/page[@id='times']" position="after">
|
<xpath expr="/form/notebook/page[@id='report']" position="inside">
|
||||||
<page id="diagnosis" string="Diagnosis">
|
<label name="diagnostician"/>
|
||||||
<label name="diagnostician"/>
|
<field name="diagnostician"/>
|
||||||
<field name="diagnostician"/>
|
<label name="not_block_diagnosis"/>
|
||||||
<label name="not_block_diagnosis"/>
|
<field name="not_block_diagnosis"/>
|
||||||
<field name="not_block_diagnosis"/>
|
|
||||||
</page>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -6,6 +6,7 @@ from trytond.pool import Pool
|
||||||
from . import action
|
from . import action
|
||||||
from . import html_template
|
from . import html_template
|
||||||
from . import sample
|
from . import sample
|
||||||
|
from . import analysis
|
||||||
from . import results_report
|
from . import results_report
|
||||||
from . import notebook
|
from . import notebook
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ def register():
|
||||||
html_template.ReportTemplateTrendChart,
|
html_template.ReportTemplateTrendChart,
|
||||||
sample.Sample,
|
sample.Sample,
|
||||||
sample.CreateSampleStart,
|
sample.CreateSampleStart,
|
||||||
|
analysis.Analysis,
|
||||||
results_report.ResultsReportVersionDetail,
|
results_report.ResultsReportVersionDetail,
|
||||||
results_report.ResultsReportVersionDetailSection,
|
results_report.ResultsReportVersionDetailSection,
|
||||||
results_report.ResultsReportVersionDetailTrendChart,
|
results_report.ResultsReportVersionDetailTrendChart,
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# This file is part of lims_report_html module for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains
|
||||||
|
# the full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.model import fields
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
from trytond.pyson import Eval
|
||||||
|
|
||||||
|
|
||||||
|
class Analysis(metaclass=PoolMeta):
|
||||||
|
__name__ = 'lims.analysis'
|
||||||
|
|
||||||
|
result_template = fields.Many2One('lims.result_report.template',
|
||||||
|
'Report Template', domain=[('type', 'in', [None, 'base'])],
|
||||||
|
states={'readonly': Eval('type') != 'group'},
|
||||||
|
depends=['type'])
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- Analysis/Set/Group -->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="analysis_view_form">
|
||||||
|
<field name="model">lims.analysis</field>
|
||||||
|
<field name="inherit" ref="lims.lims_analysis_view_form"/>
|
||||||
|
<field name="name">analysis_form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</tryton>
|
|
@ -2,6 +2,10 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||||
|
|
||||||
|
msgctxt "field:lims.analysis,result_template:"
|
||||||
|
msgid "Report Template"
|
||||||
|
msgstr "Plantilla de Informe"
|
||||||
|
|
||||||
msgctxt "field:lims.create_sample.start,result_template:"
|
msgctxt "field:lims.create_sample.start,result_template:"
|
||||||
msgid "Report Template"
|
msgid "Report Template"
|
||||||
msgstr "Plantilla de Informe"
|
msgstr "Plantilla de Informe"
|
||||||
|
@ -286,6 +290,10 @@ msgctxt "selection:lims.results_report.version.detail.section,position:"
|
||||||
msgid "Previous"
|
msgid "Previous"
|
||||||
msgstr "Anterior"
|
msgstr "Anterior"
|
||||||
|
|
||||||
|
msgctxt "view:lims.analysis:"
|
||||||
|
msgid "Report"
|
||||||
|
msgstr "Informe"
|
||||||
|
|
||||||
msgctxt "view:lims.result_report.template:"
|
msgctxt "view:lims.result_report.template:"
|
||||||
msgid "Header and Footer"
|
msgid "Header and Footer"
|
||||||
msgstr "Encabezado y Pie de página"
|
msgstr "Encabezado y Pie de página"
|
||||||
|
|
|
@ -104,7 +104,7 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
||||||
detail_default = super()._get_fields_from_samples(samples)
|
detail_default = super()._get_fields_from_samples(samples)
|
||||||
for sample in samples:
|
for sample in samples:
|
||||||
notebook = Notebook(sample['notebook'])
|
notebook = Notebook(sample['notebook'])
|
||||||
result_template = notebook.fraction.sample.result_template
|
result_template = cls._get_result_template_from_sample(notebook)
|
||||||
if result_template:
|
if result_template:
|
||||||
detail_default['template'] = result_template.id
|
detail_default['template'] = result_template.id
|
||||||
if result_template.trend_charts:
|
if result_template.trend_charts:
|
||||||
|
@ -127,6 +127,27 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
||||||
detail_default['resultrange_origin'] = resultrange_origin.id
|
detail_default['resultrange_origin'] = resultrange_origin.id
|
||||||
return detail_default
|
return detail_default
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_result_template_from_sample(cls, notebook):
|
||||||
|
Service = Pool().get('lims.service')
|
||||||
|
result_template = notebook.fraction.sample.result_template
|
||||||
|
if not result_template:
|
||||||
|
ok = True
|
||||||
|
services = Service.search([
|
||||||
|
('fraction', '=', notebook.fraction),
|
||||||
|
])
|
||||||
|
for service in services:
|
||||||
|
if service.analysis.result_template:
|
||||||
|
if not result_template:
|
||||||
|
result_template = service.analysis.result_template
|
||||||
|
elif result_template != service.analysis.result_template:
|
||||||
|
ok = False
|
||||||
|
elif result_template:
|
||||||
|
ok = False
|
||||||
|
if not ok:
|
||||||
|
result_template = None
|
||||||
|
return result_template
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_fields_from_detail(cls, detail):
|
def _get_fields_from_detail(cls, detail):
|
||||||
detail_default = super()._get_fields_from_detail(detail)
|
detail_default = super()._get_fields_from_detail(detail)
|
||||||
|
|
|
@ -5,5 +5,6 @@ depends:
|
||||||
xml:
|
xml:
|
||||||
html_template.xml
|
html_template.xml
|
||||||
sample.xml
|
sample.xml
|
||||||
|
analysis.xml
|
||||||
results_report.xml
|
results_report.xml
|
||||||
message.xml
|
message.xml
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<data>
|
||||||
|
<xpath expr="/form/notebook/page[@id='times']" position="after">
|
||||||
|
<page id="report" string="Report">
|
||||||
|
<label name="result_template"/>
|
||||||
|
<field name="result_template"/>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
Loading…
Reference in New Issue