lims_interface: add access to compilations in referral of services

This commit is contained in:
Adrián Bernardi 2020-07-01 19:57:13 -03:00
parent 43b2265df1
commit 0a02f6840a
6 changed files with 61 additions and 1 deletions

View file

@ -5592,7 +5592,6 @@ class ReferService(Wizard):
default['services'] = self._get_services()
return default
def _get_services(self):
EntryDetailAnalysis = Pool().get('lims.entry.detail.analysis')
details = EntryDetailAnalysis.search([

View file

@ -7,6 +7,7 @@ from . import interface
from . import table
from . import data
from . import notebook
from . import sample
def register():
@ -34,4 +35,5 @@ def register():
interface.OpenCompilationData,
interface.CopyInterfaceColumn,
interface.TestFormula,
sample.OpenReferralCompilation,
module='lims_interface', type_='wizard')

View file

@ -498,6 +498,10 @@ msgctxt "model:ir.action,name:wiz_interface_formula_test"
msgid "Test Formula"
msgstr "Probar Fórmula"
msgctxt "model:ir.action,name:wiz_referral_open_compilation"
msgid "Interface Compilations"
msgstr "Compilaciones desde interfaz"
msgctxt "model:ir.message,text:delete_done_compilation"
msgid "You cannot delete a Compilation in \"Done\" state"
msgstr "No puede eliminar una Compilación en estado \"Realizada\""

36
lims_interface/sample.py Normal file
View file

@ -0,0 +1,36 @@
# This file is part of lims_interface module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.wizard import Wizard, StateAction
from trytond.pool import Pool
from trytond.pyson import PYSONEncoder
from trytond.transaction import Transaction
__all__ = ['OpenReferralCompilation']
class OpenReferralCompilation(Wizard):
'Open Compilation'
__name__ = 'lims.referral.open_compilation'
start = StateAction('lims_interface.act_lims_interface_compilation_list')
def do_start(self, action):
cursor = Transaction().connection.cursor()
pool = Pool()
NotebookLine = pool.get('lims.notebook.line')
EntryDetailAnalysis = pool.get('lims.entry.detail.analysis')
referral_ids = ', '.join(str(r)
for r in Transaction().context['active_ids'] + [0])
cursor.execute('SELECT nl.compilation '
'FROM "' + NotebookLine._table + '" nl '
'INNER JOIN "' + EntryDetailAnalysis._table + '" d '
'ON d.id = nl.analysis_detail '
'WHERE d.referral IN (' + referral_ids + ')')
res = [x[0] for x in cursor.fetchall()]
action['pyson_domain'] = PYSONEncoder().encode([
('id', 'in', res)])
return action, {}

18
lims_interface/sample.xml Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<tryton>
<data>
<!-- Wizard Open Compilation -->
<record model="ir.action.wizard" id="wiz_referral_open_compilation">
<field name="name">Interface Compilations</field>
<field name="wiz_name">lims.referral.open_compilation</field>
</record>
<record model="ir.action.keyword" id="wiz_referral_open_compilation_keyword">
<field name="keyword">form_relate</field>
<field name="model">lims.referral,-1</field>
<field name="action" ref="wiz_referral_open_compilation"/>
</record>
</data>
</tryton>

View file

@ -4,4 +4,5 @@ depends:
lims
xml:
interface.xml
sample.xml
message.xml