mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_planning_automatic: use user professional when activate sheet
This commit is contained in:
parent
f2ac1ce7a1
commit
3bc29a3d6f
|
@ -6,6 +6,7 @@ from trytond.pool import Pool
|
|||
from . import planification
|
||||
from . import laboratory
|
||||
from . import entry
|
||||
from . import sheet
|
||||
from . import quality
|
||||
|
||||
|
||||
|
@ -14,6 +15,7 @@ def register():
|
|||
planification.Planification,
|
||||
laboratory.Laboratory,
|
||||
entry.Entry,
|
||||
sheet.AnalysisSheet,
|
||||
module='lims_planning_automatic', type_='model')
|
||||
Pool.register(
|
||||
quality.QualityTest,
|
||||
|
|
24
lims_planning_automatic/sheet.py
Normal file
24
lims_planning_automatic/sheet.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# This file is part of lims_planning_automatic 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, PoolMeta
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
|
||||
|
||||
class AnalysisSheet(metaclass=PoolMeta):
|
||||
__name__ = 'lims.analysis_sheet'
|
||||
|
||||
@classmethod
|
||||
def activate(cls, sheets):
|
||||
LaboratoryProfessional = Pool().get('lims.laboratory.professional')
|
||||
|
||||
super().activate(sheets)
|
||||
professional_id = LaboratoryProfessional.get_lab_professional()
|
||||
if not professional_id:
|
||||
raise UserError(gettext('lims_rack.msg_user_no_professional'))
|
||||
|
||||
for s in sheets:
|
||||
s.professional = professional_id
|
||||
s.save()
|
Loading…
Reference in a new issue