mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: move global function
This commit is contained in:
parent
11b770b141
commit
60bbc0ec08
|
@ -2,6 +2,7 @@
|
|||
# This file is part of lims module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from datetime import datetime
|
||||
|
||||
from trytond.model import ModelSingleton, ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Eval
|
||||
|
@ -22,6 +23,16 @@ sequence_names = [
|
|||
'results_report_sequence']
|
||||
|
||||
|
||||
def get_print_date():
|
||||
Company = Pool().get('company.company')
|
||||
|
||||
date = datetime.now()
|
||||
company_id = Transaction().context.get('company')
|
||||
if company_id:
|
||||
date = Company(company_id).convert_timezone_datetime(date)
|
||||
return date
|
||||
|
||||
|
||||
class NotebookView(ModelSQL, ModelView):
|
||||
'Laboratory Notebook View'
|
||||
__name__ = 'lims.notebook.view'
|
||||
|
|
|
@ -18,8 +18,8 @@ from trytond.transaction import Transaction
|
|||
from trytond.report import Report
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from .configuration import get_print_date
|
||||
from .formula_parser import FormulaParser
|
||||
from .results_report import get_print_date
|
||||
|
||||
__all__ = ['Notebook', 'NotebookLine', 'NotebookLineAllFields',
|
||||
'NotebookLineLaboratoryProfessional',
|
||||
|
|
|
@ -15,7 +15,7 @@ from trytond.transaction import Transaction
|
|||
from trytond.pyson import PYSONEncoder, Eval, Equal, Bool, Not, Or
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from .results_report import get_print_date
|
||||
from .configuration import get_print_date
|
||||
|
||||
__all__ = ['Planification', 'PlanificationTechnician',
|
||||
'PlanificationTechnicianDetail', 'PlanificationDetail',
|
||||
|
|
|
@ -17,6 +17,7 @@ from trytond.report import Report
|
|||
from trytond.rpc import RPC
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from .configuration import get_print_date
|
||||
|
||||
__all__ = ['ResultsReport', 'ResultsReportVersion',
|
||||
'ResultsReportVersionDetail', 'ResultsReportVersionDetailSample',
|
||||
|
@ -36,16 +37,6 @@ __all__ = ['ResultsReport', 'ResultsReportVersion',
|
|||
'GlobalResultReport', 'ResultReportTranscription']
|
||||
|
||||
|
||||
def get_print_date():
|
||||
Company = Pool().get('company.company')
|
||||
|
||||
date = datetime.now()
|
||||
company_id = Transaction().context.get('company')
|
||||
if company_id:
|
||||
date = Company(company_id).convert_timezone_datetime(date)
|
||||
return date
|
||||
|
||||
|
||||
class ResultsReport(ModelSQL, ModelView):
|
||||
'Results Report'
|
||||
__name__ = 'lims.results_report'
|
||||
|
|
Loading…
Reference in a new issue