lims_diagnosis: Results Report: add state Diagnosed
This commit is contained in:
parent
8c7b0a8940
commit
98b012e68b
|
@ -114,6 +114,10 @@ msgctxt "model:lims.diagnostician,name:"
|
|||
msgid "Diagnostician"
|
||||
msgstr "Diagnosticador"
|
||||
|
||||
msgctxt "selection:lims.results_report.version.detail,state:"
|
||||
msgid "Diagnosed"
|
||||
msgstr "Diagnosticado"
|
||||
|
||||
msgctxt "view:lims.analysis:"
|
||||
msgid "Diagnosis"
|
||||
msgstr "Diagnóstico"
|
||||
|
@ -129,3 +133,7 @@ msgstr "Contenido"
|
|||
msgctxt "view:lims.diagnosis.template:"
|
||||
msgid "States"
|
||||
msgstr "Estados"
|
||||
|
||||
msgctxt "view:lims.results_report.version.detail:"
|
||||
msgid "Diagnosed"
|
||||
msgstr "Diagnosticado"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# 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.model import ModelView, fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
@ -17,3 +17,22 @@ class ResultsReportVersionDetail(metaclass=PoolMeta):
|
|||
diagnosis_template = fields.Many2One('lims.diagnosis.template',
|
||||
'Diagnosis Template', depends=['state'],
|
||||
states={'readonly': Eval('state') != 'draft'})
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ResultsReportVersionDetail, cls).__setup__()
|
||||
diagnosed_state = ('diagnosed', 'Diagnosed')
|
||||
if diagnosed_state not in cls.state.selection:
|
||||
cls.state.selection.append(diagnosed_state)
|
||||
cls._buttons.update({
|
||||
'diagnose': {
|
||||
'invisible': Eval('state') != 'draft',
|
||||
'depends': ['state'],
|
||||
},
|
||||
})
|
||||
cls._buttons['revise']['invisible'] = Eval('state') != 'diagnosed'
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def diagnose(cls, details):
|
||||
cls.write(details, {'state': 'diagnosed'})
|
||||
|
|
|
@ -15,5 +15,15 @@
|
|||
<field name="name">results_report_version_detail_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="results_report_version_detail_diagnose_button">
|
||||
<field name="name">diagnose</field>
|
||||
<field name="model" search="[('model', '=', 'lims.results_report.version.detail')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group"
|
||||
id="results_report_version_detail_diagnose_button_group_lims_laboratory_reports">
|
||||
<field name="button" ref="results_report_version_detail_diagnose_button"/>
|
||||
<field name="group" ref="lims.group_lims_laboratory_reports"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -8,4 +8,7 @@
|
|||
<label name="diagnostician"/>
|
||||
<field name="diagnostician"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/group[@id='buttons']" position="inside">
|
||||
<button name="diagnose" string="Diagnosed"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue