lims_analysis_sheet: add function to get device correction

This commit is contained in:
Adrián Bernardi 2020-03-26 10:13:11 -03:00
parent 04c557b258
commit 6f3656e662
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# This file is part of lims_analysis_sheet module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.pool import Pool
def device_correction(device_id, value):
LabDevice = Pool().get('lims.lab.device')
if device_id and value:
device = LabDevice(device_id)
if device:
return device.get_correction(value)
return value
custom_functions = {}
custom_functions['DEVICE_CORRECTION'] = device_correction

View File

@ -9,10 +9,15 @@ from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval, Bool, Or, And
from trytond.transaction import Transaction
from trytond.modules.lims_interface.data import Adapter
from trytond.modules.lims_interface.interface import FUNCTIONS
from .function import custom_functions
__all__ = ['Compilation', 'Column', 'Interface', 'Table', 'Data']
FUNCTIONS.update(custom_functions)
class Compilation(metaclass=PoolMeta):
__name__ = 'lims.interface.compilation'