lims_industry: add related access to results report precedents
This commit is contained in:
parent
f1f4a00ded
commit
97f0e1a649
|
@ -2957,7 +2957,7 @@ class OpenResultsDetailEntry(Wizard):
|
|||
|
||||
def do_start(self, action):
|
||||
pool = Pool()
|
||||
ResultsDetail = Pool().get('lims.results_report.version.detail')
|
||||
ResultsDetail = pool.get('lims.results_report.version.detail')
|
||||
ResultsSample = pool.get('lims.results_report.version.detail.sample')
|
||||
|
||||
active_ids = Transaction().context['active_ids']
|
||||
|
|
|
@ -45,4 +45,5 @@ def register():
|
|||
Pool.register(
|
||||
sample.CreateSample,
|
||||
sample.EditSample,
|
||||
results_report.OpenResultsDetailPrecedent,
|
||||
module='lims_industry', type_='wizard')
|
||||
|
|
|
@ -609,6 +609,10 @@ msgctxt "model:ir.action,name:wiz_edit_sample"
|
|||
msgid "Edit Samples"
|
||||
msgstr "Modificar muestras"
|
||||
|
||||
msgctxt "model:ir.action,name:wiz_results_detail_open_precedent"
|
||||
msgid "Results Report Precedents"
|
||||
msgstr "Antecedentes del Informe de resultados"
|
||||
|
||||
msgctxt "model:ir.message,text:lbl_component_missing_data"
|
||||
msgid "Missing data in Component"
|
||||
msgstr "Faltan datos en Componente"
|
||||
|
@ -621,6 +625,10 @@ msgctxt "model:ir.message,text:lbl_party_incomplete_file"
|
|||
msgid "Incomplete file in Party"
|
||||
msgstr "Ficha incompleta en Tercero"
|
||||
|
||||
msgctxt "model:ir.message,text:lbl_precedents"
|
||||
msgid "Precedents"
|
||||
msgstr "Antecedentes"
|
||||
|
||||
msgctxt "model:ir.message,text:lbl_sample_insufficient_volume"
|
||||
msgid "Insufficient volume in Sample"
|
||||
msgstr "Volumen insuficiente en Muestra"
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
<record model="ir.message" id="lbl_party_incomplete_file">
|
||||
<field name="text">Incomplete file in Party</field>
|
||||
</record>
|
||||
<record model="ir.message" id="lbl_precedents">
|
||||
<field name="text">Precedents</field>
|
||||
</record>
|
||||
<record model="ir.message" id="lbl_sample_insufficient_volume">
|
||||
<field name="text">Insufficient volume in Sample</field>
|
||||
</record>
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
# the full copyright notices and license terms.
|
||||
|
||||
from trytond.model import fields
|
||||
from trytond.wizard import Wizard, StateAction
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import PYSONEncoder, Eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.i18n import gettext
|
||||
|
||||
__all__ = ['ResultsReportVersionDetailSample',
|
||||
'ResultsReportVersionDetailLine']
|
||||
'ResultsReportVersionDetailLine', 'OpenResultsDetailPrecedent']
|
||||
|
||||
|
||||
class ResultsReportVersionDetailSample(metaclass=PoolMeta):
|
||||
|
@ -136,3 +139,47 @@ class ResultsReportVersionDetailLine(metaclass=PoolMeta):
|
|||
if not precedent_line:
|
||||
return None
|
||||
return cls._get_result(precedent_line[0])
|
||||
|
||||
|
||||
class OpenResultsDetailPrecedent(Wizard):
|
||||
'Results Report Precedent'
|
||||
__name__ = 'lims.results_report.version.detail.open_precedent'
|
||||
|
||||
start = StateAction('lims.act_lims_results_report')
|
||||
|
||||
def do_start(self, action):
|
||||
pool = Pool()
|
||||
ResultsReport = pool.get('lims.results_report')
|
||||
ResultsDetail = pool.get('lims.results_report.version.detail')
|
||||
ResultsSample = pool.get('lims.results_report.version.detail.sample')
|
||||
Notebook = pool.get('lims.notebook')
|
||||
|
||||
active_ids = Transaction().context['active_ids']
|
||||
details = ResultsDetail.browse(active_ids)
|
||||
|
||||
component_ids = []
|
||||
samples = ResultsSample.search([
|
||||
('version_detail', 'in', active_ids),
|
||||
])
|
||||
for s in samples:
|
||||
if s.component:
|
||||
component_ids.append(s.component.id)
|
||||
|
||||
notebooks = Notebook.search([
|
||||
('component', 'in', component_ids),
|
||||
])
|
||||
notebook_ids = [n.id for n in notebooks]
|
||||
|
||||
reports = ResultsReport.search([
|
||||
('versions.details.samples.notebook', 'in', notebook_ids),
|
||||
('versions.details.id', 'not in', active_ids),
|
||||
])
|
||||
results_report_ids = [r.id for r in reports]
|
||||
|
||||
action['pyson_domain'] = PYSONEncoder().encode([
|
||||
('id', 'in', results_report_ids),
|
||||
])
|
||||
action['name'] = '%s (%s)' % (gettext('lims_industry.lbl_precedents'),
|
||||
', '.join('%s-%s' % (d.report_version.number, d.number)
|
||||
for d in details))
|
||||
return action, {}
|
||||
|
|
|
@ -18,5 +18,17 @@
|
|||
<field name="name">results_report_version_detail_line_list</field>
|
||||
</record>
|
||||
|
||||
<!-- Wizard Open Results Report Precedent -->
|
||||
|
||||
<record model="ir.action.wizard" id="wiz_results_detail_open_precedent">
|
||||
<field name="name">Results Report Precedents</field>
|
||||
<field name="wiz_name">lims.results_report.version.detail.open_precedent</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="wiz_results_detail_open_precedent_keyword">
|
||||
<field name="keyword">form_relate</field>
|
||||
<field name="model">lims.results_report.version.detail,-1</field>
|
||||
<field name="action" ref="wiz_results_detail_open_precedent"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
Loading…
Reference in New Issue