mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: samples pending reporting: show entry number and qty of samples
This commit is contained in:
parent
6240e40afa
commit
1c1df672db
|
@ -2599,6 +2599,10 @@ msgctxt "field:lims.notebook,divided_report:"
|
||||||
msgid "Divided report"
|
msgid "Divided report"
|
||||||
msgstr "Informe dividido"
|
msgstr "Informe dividido"
|
||||||
|
|
||||||
|
msgctxt "field:lims.notebook,entry_summary:"
|
||||||
|
msgid "Entry / Qty. Samples"
|
||||||
|
msgstr "Ingreso / Cant. Muestras"
|
||||||
|
|
||||||
msgctxt "field:lims.notebook,fraction:"
|
msgctxt "field:lims.notebook,fraction:"
|
||||||
msgid "Fraction"
|
msgid "Fraction"
|
||||||
msgstr "Fracción"
|
msgstr "Fracción"
|
||||||
|
|
|
@ -75,6 +75,8 @@ class Notebook(ModelSQL, ModelView):
|
||||||
'get_acceptance_pending', searcher='search_acceptance_pending')
|
'get_acceptance_pending', searcher='search_acceptance_pending')
|
||||||
urgent = fields.Function(fields.Boolean('Urgent'), 'get_urgent',
|
urgent = fields.Function(fields.Boolean('Urgent'), 'get_urgent',
|
||||||
searcher='search_urgent')
|
searcher='search_urgent')
|
||||||
|
entry_summary = fields.Function(fields.Char('Entry / Qty. Samples'),
|
||||||
|
'get_entry_summary', searcher='search_entry_summary')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -731,6 +733,43 @@ class Notebook(ModelSQL, ModelView):
|
||||||
return [('id', 'not in', [u.id for u in urgents])]
|
return [('id', 'not in', [u.id for u in urgents])]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_entry_summary(cls, notebooks, name):
|
||||||
|
cursor = Transaction().connection.cursor()
|
||||||
|
pool = Pool()
|
||||||
|
Entry = pool.get('lims.entry')
|
||||||
|
Sample = pool.get('lims.sample')
|
||||||
|
Fraction = pool.get('lims.fraction')
|
||||||
|
|
||||||
|
result = {}
|
||||||
|
for n in notebooks:
|
||||||
|
result[n.id] = ''
|
||||||
|
|
||||||
|
cursor.execute('SELECT s.entry '
|
||||||
|
'FROM "' + Sample._table + '" s '
|
||||||
|
'INNER JOIN "' + Fraction._table + '" f '
|
||||||
|
'ON s.id = f.sample '
|
||||||
|
'WHERE f.id = %s',
|
||||||
|
(str(n.fraction.id),))
|
||||||
|
entry_id = cursor.fetchone()[0]
|
||||||
|
|
||||||
|
cursor.execute('SELECT e.number, count(s.id) '
|
||||||
|
'FROM "' + Entry._table + '" e '
|
||||||
|
'INNER JOIN "' + Sample._table + '" s '
|
||||||
|
'ON e.id = s.entry '
|
||||||
|
'WHERE e.id = %s '
|
||||||
|
'GROUP BY e.number',
|
||||||
|
(str(entry_id),))
|
||||||
|
res = cursor.fetchone()
|
||||||
|
if not res:
|
||||||
|
continue
|
||||||
|
result[n.id] = '%s/%s' % (res[0], res[1])
|
||||||
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def search_entry_summary(cls, name, clause):
|
||||||
|
return [('fraction.sample.entry.number',) + tuple(clause[1:])]
|
||||||
|
|
||||||
|
|
||||||
class NotebookLine(ModelSQL, ModelView):
|
class NotebookLine(ModelSQL, ModelView):
|
||||||
'Laboratory Notebook Line'
|
'Laboratory Notebook Line'
|
||||||
|
|
|
@ -9,5 +9,6 @@
|
||||||
<field name="label"/>
|
<field name="label"/>
|
||||||
<field name="fraction_type"/>
|
<field name="fraction_type"/>
|
||||||
<field name="department"/>
|
<field name="department"/>
|
||||||
|
<field name="entry_summary"/>
|
||||||
<field name="urgent"/>
|
<field name="urgent"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
Loading…
Reference in a new issue