lims_report_html: allow to configure default result report template
This commit is contained in:
parent
0589a8b109
commit
b0abb54348
|
@ -5,6 +5,7 @@
|
|||
from trytond.pool import Pool
|
||||
from . import action
|
||||
from . import html_template
|
||||
from . import configuration
|
||||
from . import sample
|
||||
from . import analysis
|
||||
from . import results_report
|
||||
|
@ -18,6 +19,7 @@ def register():
|
|||
html_template.ReportTemplateTranslation,
|
||||
html_template.ReportTemplateSection,
|
||||
html_template.ReportTemplateTrendChart,
|
||||
configuration.Configuration,
|
||||
sample.Fraction,
|
||||
sample.Sample,
|
||||
sample.CreateSampleStart,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# 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
|
||||
|
||||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'lims.configuration'
|
||||
|
||||
result_template = fields.Many2One('lims.result_report.template',
|
||||
'Default Report Template', domain=[('type', 'in', [None, 'base'])])
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<!-- Configuration -->
|
||||
|
||||
<record model="ir.ui.view" id="lims_configuration_view">
|
||||
<field name="model">lims.configuration</field>
|
||||
<field name="inherit" ref="lims.lims_configuration_view"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
|
@ -6,6 +6,10 @@ msgctxt "field:lims.analysis,result_template:"
|
|||
msgid "Report Template"
|
||||
msgstr "Plantilla de Informe"
|
||||
|
||||
msgctxt "field:lims.configuration,result_template:"
|
||||
msgid "Default Report Template"
|
||||
msgstr "Plantilla de Informe por defecto"
|
||||
|
||||
msgctxt "field:lims.create_sample.start,result_template:"
|
||||
msgid "Report Template"
|
||||
msgstr "Plantilla de Informe"
|
||||
|
@ -54,6 +58,10 @@ msgctxt "field:lims.result_report.template,name:"
|
|||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:lims.result_report.template,page_orientation:"
|
||||
msgid "Page orientation"
|
||||
msgstr "Orientación de la página"
|
||||
|
||||
msgctxt "field:lims.result_report.template,previous_sections:"
|
||||
msgid "Previous Sections"
|
||||
msgstr "Secciones anteriores"
|
||||
|
@ -82,10 +90,6 @@ msgctxt "field:lims.result_report.template,type:"
|
|||
msgid "Type"
|
||||
msgstr "Tipo"
|
||||
|
||||
msgctxt "field:lims.result_report.template,page_orientation:"
|
||||
msgid "Page orientation"
|
||||
msgstr "Orientación de la página"
|
||||
|
||||
msgctxt "field:lims.result_report.template.section,data:"
|
||||
msgid "File"
|
||||
msgstr "Archivo"
|
||||
|
@ -282,6 +286,14 @@ msgctxt "selection:lims.result_report.template,charts_x_row:"
|
|||
msgid "2"
|
||||
msgstr "2"
|
||||
|
||||
msgctxt "selection:lims.result_report.template,page_orientation:"
|
||||
msgid "Landscape"
|
||||
msgstr "Horizontal"
|
||||
|
||||
msgctxt "selection:lims.result_report.template,page_orientation:"
|
||||
msgid "Portrait"
|
||||
msgstr "Vertical"
|
||||
|
||||
msgctxt "selection:lims.result_report.template,type:"
|
||||
msgid "HTML"
|
||||
msgstr "HTML"
|
||||
|
@ -294,14 +306,6 @@ msgctxt "selection:lims.result_report.template,type:"
|
|||
msgid "HTML - Header"
|
||||
msgstr "HTML - Encabezado"
|
||||
|
||||
msgctxt "selection:lims.result_report.template,page_orientation:"
|
||||
msgid "Portrait"
|
||||
msgstr "Vertical"
|
||||
|
||||
msgctxt "selection:lims.result_report.template,page_orientation:"
|
||||
msgid "Landscape"
|
||||
msgstr "Horizontal"
|
||||
|
||||
msgctxt "selection:lims.result_report.template.section,position:"
|
||||
msgid "Following"
|
||||
msgstr "Siguiente"
|
||||
|
|
|
@ -174,7 +174,10 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
|||
|
||||
@classmethod
|
||||
def _get_result_template_from_sample(cls, notebook):
|
||||
Service = Pool().get('lims.service')
|
||||
pool = Pool()
|
||||
Service = pool.get('lims.service')
|
||||
Configuration = pool.get('lims.configuration')
|
||||
|
||||
result_template = notebook.fraction.sample.result_template
|
||||
if not result_template:
|
||||
ok = True
|
||||
|
@ -193,6 +196,11 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
|||
ok = False
|
||||
if not ok:
|
||||
result_template = None
|
||||
|
||||
if not result_template:
|
||||
config_ = Configuration(1)
|
||||
result_template = config_.result_template
|
||||
|
||||
return result_template
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -4,6 +4,7 @@ depends:
|
|||
lims
|
||||
xml:
|
||||
html_template.xml
|
||||
configuration.xml
|
||||
sample.xml
|
||||
analysis.xml
|
||||
results_report.xml
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<data>
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='general']/field[@name='results_report_language']"
|
||||
position="after">
|
||||
<label name="result_template"/>
|
||||
<field name="result_template"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue