From bdbfafbeb876f67733bd21729acf01017183b882 Mon Sep 17 00:00:00 2001 From: Adri?n Bernardi Date: Tue, 17 Mar 2020 09:27:33 -0300 Subject: [PATCH] lims_result_warning: warn result with custom message --- lims_result_warning/locale/es.po | 6 +++--- lims_result_warning/notebook.py | 9 +++++---- lims_result_warning/view/notebook_line_form.xml | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lims_result_warning/locale/es.po b/lims_result_warning/locale/es.po index 1b87f373..7e85f8df 100644 --- a/lims_result_warning/locale/es.po +++ b/lims_result_warning/locale/es.po @@ -2,9 +2,9 @@ msgid "" msgstr "Content-Type: text/plain; charset=utf-8\n" -msgctxt "field:lims.notebook.line,warn_result:" -msgid "Warn Result" -msgstr "Advertir resultado" +msgctxt "field:lims.notebook.line,result_warning:" +msgid "Result Warning" +msgstr "Advertencia de resultado" msgctxt "model:ir.message,text:lbl_result_warning" msgid "Result Warning" diff --git a/lims_result_warning/notebook.py b/lims_result_warning/notebook.py index 4358067b..acbe296b 100644 --- a/lims_result_warning/notebook.py +++ b/lims_result_warning/notebook.py @@ -11,7 +11,7 @@ __all__ = ['NotebookLine'] class NotebookLine(metaclass=PoolMeta): __name__ = 'lims.notebook.line' - warn_result = fields.Boolean('Warn Result') + result_warning = fields.Char('Result Warning') @classmethod def write(cls, *args): @@ -19,16 +19,17 @@ class NotebookLine(metaclass=PoolMeta): super(NotebookLine, cls).write(*args) actions = iter(args) for lines, vals in zip(actions, actions): - if vals.get('warn_result', False): + if vals.get('result_warning', False): TaskTemplate.create_tasks('result_warning', - cls._for_task_result_warning(lines)) + cls._for_task_result_warning(lines), + description=vals.get('result_warning')) @classmethod def _for_task_result_warning(cls, lines): AdministrativeTask = Pool().get('lims.administrative.task') res = [] for line in lines: - if not line.warn_result: + if not line.result_warning: continue if AdministrativeTask.search([ ('type', '=', 'result_warning'), diff --git a/lims_result_warning/view/notebook_line_form.xml b/lims_result_warning/view/notebook_line_form.xml index 43587888..0c72a285 100644 --- a/lims_result_warning/view/notebook_line_form.xml +++ b/lims_result_warning/view/notebook_line_form.xml @@ -1,7 +1,7 @@ -