mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_industry: add hs. component in notebook
This commit is contained in:
parent
e0523d5fbe
commit
bf68fb54ae
|
@ -32,6 +32,7 @@ def register():
|
|||
analysis.Analysis,
|
||||
sample.Entry,
|
||||
sample.Sample,
|
||||
sample.Fraction,
|
||||
sample.CreateSampleStart,
|
||||
sample.EditSampleStart,
|
||||
notebook.Notebook,
|
||||
|
|
|
@ -278,6 +278,10 @@ msgctxt "field:lims.equipment.type,name:"
|
|||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:lims.fraction,hours_component:"
|
||||
msgid "Hs. Component"
|
||||
msgstr "Hs. Componente"
|
||||
|
||||
msgctxt "field:lims.notebook,component:"
|
||||
msgid "Component"
|
||||
msgstr "Componente"
|
||||
|
@ -286,6 +290,10 @@ msgctxt "field:lims.notebook,equipment:"
|
|||
msgid "Equipment"
|
||||
msgstr "Equipo"
|
||||
|
||||
msgctxt "field:lims.notebook,hours_component:"
|
||||
msgid "Hs. Component"
|
||||
msgstr "Hs. Componente"
|
||||
|
||||
msgctxt "field:lims.notebook,plant:"
|
||||
msgid "Plant"
|
||||
msgstr "Planta"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# the full copyright notices and license terms.
|
||||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
__all__ = ['Notebook']
|
||||
|
||||
|
@ -17,3 +17,23 @@ class Notebook(metaclass=PoolMeta):
|
|||
'get_sample_field', searcher='search_sample_field')
|
||||
component = fields.Function(fields.Many2One('lims.component', 'Component'),
|
||||
'get_sample_field', searcher='search_sample_field')
|
||||
hours_component = fields.Function(fields.Integer('Hs. Component'),
|
||||
'get_sample_field', searcher='search_sample_field')
|
||||
|
||||
def _order_sample_field(name):
|
||||
def order_field(tables):
|
||||
pool = Pool()
|
||||
Sample = pool.get('lims.sample')
|
||||
Fraction = pool.get('lims.fraction')
|
||||
field = Sample._fields[name]
|
||||
table, _ = tables[None]
|
||||
fraction_tables = tables.get('fraction')
|
||||
if fraction_tables is None:
|
||||
fraction = Fraction.__table__()
|
||||
fraction_tables = {
|
||||
None: (fraction, fraction.id == table.fraction),
|
||||
}
|
||||
tables['fraction'] = fraction_tables
|
||||
return field.convert_order(name, fraction_tables, Fraction)
|
||||
return staticmethod(order_field)
|
||||
order_hours_component = _order_sample_field('hours_component')
|
||||
|
|
|
@ -8,7 +8,7 @@ from trytond.pool import Pool, PoolMeta
|
|||
from trytond.pyson import Eval, Bool
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['Entry', 'Sample', 'CreateSampleStart', 'CreateSample',
|
||||
__all__ = ['Entry', 'Sample', 'Fraction', 'CreateSampleStart', 'CreateSample',
|
||||
'EditSampleStart', 'EditSample']
|
||||
|
||||
|
||||
|
@ -160,6 +160,30 @@ class Sample(metaclass=PoolMeta):
|
|||
return result
|
||||
|
||||
|
||||
class Fraction(metaclass=PoolMeta):
|
||||
__name__ = 'lims.fraction'
|
||||
|
||||
hours_component = fields.Function(fields.Integer('Hs. Component'),
|
||||
'get_sample_field', searcher='search_sample_field')
|
||||
|
||||
def _order_sample_field(name):
|
||||
def order_field(tables):
|
||||
pool = Pool()
|
||||
Sample = pool.get('lims.sample')
|
||||
field = Sample._fields[name]
|
||||
table, _ = tables[None]
|
||||
sample_tables = tables.get('sample')
|
||||
if sample_tables is None:
|
||||
sample = Sample.__table__()
|
||||
sample_tables = {
|
||||
None: (sample, sample.id == table.sample),
|
||||
}
|
||||
tables['sample'] = sample_tables
|
||||
return field.convert_order(name, sample_tables, Sample)
|
||||
return staticmethod(order_field)
|
||||
order_hours_component = _order_sample_field('hours_component')
|
||||
|
||||
|
||||
class CreateSampleStart(metaclass=PoolMeta):
|
||||
__name__ = 'lims.create_sample.start'
|
||||
|
||||
|
|
Loading…
Reference in a new issue