From 892a2da7ef1c8f91716758312c05e3db3bfa4144 Mon Sep 17 00:00:00 2001 From: Luis Rodriguez Date: Tue, 23 Apr 2024 11:31:13 +0200 Subject: [PATCH] [MIG] medical_clinical_procedure: Migration to 16.0 --- medical_clinical_procedure/README.rst | 78 ----------- medical_clinical_procedure/__init__.py | 1 - medical_clinical_procedure/__manifest__.py | 3 +- .../demo/medical_demo.xml | 122 ++++++++---------- medical_clinical_procedure/readme/CONTEXT.md | 23 ++++ medical_clinical_procedure/readme/CREDITS.md | 27 ++++ medical_clinical_procedure/readme/USAGE.md | 9 ++ .../security/ir.model.access.csv | 1 - .../tests/test_procedure_request.py | 33 ----- medical_clinical_procedure/wizard/__init__.py | 5 - ...edical_procedure_request_make_procedure.py | 31 ----- ..._procedure_request_make_procedure_view.xml | 41 ------ 12 files changed, 117 insertions(+), 257 deletions(-) create mode 100644 medical_clinical_procedure/readme/CONTEXT.md create mode 100644 medical_clinical_procedure/readme/CREDITS.md create mode 100644 medical_clinical_procedure/readme/USAGE.md delete mode 100644 medical_clinical_procedure/wizard/__init__.py delete mode 100644 medical_clinical_procedure/wizard/medical_procedure_request_make_procedure.py delete mode 100644 medical_clinical_procedure/wizard/medical_procedure_request_make_procedure_view.xml diff --git a/medical_clinical_procedure/README.rst b/medical_clinical_procedure/README.rst index 822f3ea6..61c5ba8a 100644 --- a/medical_clinical_procedure/README.rst +++ b/medical_clinical_procedure/README.rst @@ -2,53 +2,6 @@ :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 -================= -Medical Procedure -================= - -A **Procedure Request** is a record of a request for a procedure to be -planned, proposed, or performed with or on a patient. - -The **Procedure** represents an action that is or was performed on a patient. -This can be a physical intervention like an operation, or less invasive like -counseling or hypnotherapy. - -This resource is used to record the details of procedures performed on a -patient. A procedure is an activity that is performed with or on a patient as -part of the provision of care. Examples include surgical procedures, -diagnostic procedures, endoscopic procedures, biopsies, counseling, -physiotherapy, exercise, etc. - -This resource provides summary information about the occurrence of the -procedure and is not intended to provide real-time snapshots of a procedure -as it unfolds, though for long-running procedures such as psychotherapy, it -could represent summary level information about overall progress. The -creation of a resource to support detailed real-time procedure information -awaits the identification of a specific implementation use-case to share such -information. - -For more information about the FHIR Procedure Request visit: https://www.hl7.org/fhir/procedurerequest.html -For further information about the FHIR Procedure visit: https://www.hl7.org/fhir/procedure.html - -Installation -============ - -To install this module, go to 'Medical / Configuration / Settings' and inside -'Clinical' activate 'Procedures & Procedure requests'. - -Usage -===== - -#. Go to 'Medical / Clinical / Requests / Procedure Requests' -#. Click 'Create'. -#. Fill in the information. -#. Click 'Save' and press the button 'Activate'. -#. Go to 'Action / Create Procedure' to generate the according Procedure. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/159/11.0 - Bug Tracker =========== @@ -56,34 +9,3 @@ Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback. - -Credits -======= - -Images ------- - -* Clker-Free-Vector-Images: `Medical Icon `_ -* Odoo Community Association: `Odoo Icon `_. - -Contributors ------------- - -* Enric Tobella -* Roser Garcia -* Jordi Ballester - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/medical_clinical_procedure/__init__.py b/medical_clinical_procedure/__init__.py index 22ccad3a..cd881e20 100644 --- a/medical_clinical_procedure/__init__.py +++ b/medical_clinical_procedure/__init__.py @@ -3,4 +3,3 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from . import models -from . import wizard diff --git a/medical_clinical_procedure/__manifest__.py b/medical_clinical_procedure/__manifest__.py index 273487aa..f7ee84b8 100644 --- a/medical_clinical_procedure/__manifest__.py +++ b/medical_clinical_procedure/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Medical Clinical Procedure", "summary": "Medical Procedures and Procedure requests", - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "author": "CreuBlanca, ForgeFlow, Odoo Community Association (OCA), Tegin", "category": "Medical", "website": "https://github.com/tegin/medical-fhir", @@ -18,7 +18,6 @@ "security/medical_security.xml", "security/ir.model.access.csv", "data/ir_sequence.xml", - "wizard/medical_procedure_request_make_procedure_view.xml", "views/medical_request_views.xml", "views/medical_procedure_view.xml", "views/medical_procedure_request_view.xml", diff --git a/medical_clinical_procedure/demo/medical_demo.xml b/medical_clinical_procedure/demo/medical_demo.xml index 034e5e7d..d385a0ca 100644 --- a/medical_clinical_procedure/demo/medical_demo.xml +++ b/medical_clinical_procedure/demo/medical_demo.xml @@ -4,69 +4,61 @@ Copyright 2017 CreuBlanca License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). --> - - - - Time on machine service - service - - - Medical report - service - - - Quality check - service - - - MACT - Machine time - - active - - 1 - - - REP - Medical report - - active - - 1 - - - QC - Quality check - - active - - 1 - - - REP - - - - - MACT - - - - - REP - - - - - MACT - - - - + + + Time on machine service + service + + + Medical report + service + + + Quality check + service + + + MACT + Machine time + + active + + 1 + + + REP + Medical report + + active + + 1 + + + QC + Quality check + + active + + 1 + + + REP + + + + + MACT + + + + + REP + + + + + MACT + + + diff --git a/medical_clinical_procedure/readme/CONTEXT.md b/medical_clinical_procedure/readme/CONTEXT.md new file mode 100644 index 00000000..d1fb7f56 --- /dev/null +++ b/medical_clinical_procedure/readme/CONTEXT.md @@ -0,0 +1,23 @@ +A **Procedure Request** is a record of a request for a procedure to be +planned, proposed, or performed with or on a patient. + +The **Procedure** represents an action that is or was performed on a patient. +This can be a physical intervention like an operation, or less invasive like +counseling or hypnotherapy. + +This resource is used to record the details of procedures performed on a +patient. A procedure is an activity that is performed with or on a patient as +part of the provision of care. Examples include surgical procedures, +diagnostic procedures, endoscopic procedures, biopsies, counseling, +physiotherapy, exercise, etc. + +This resource provides summary information about the occurrence of the +procedure and is not intended to provide real-time snapshots of a procedure +as it unfolds, though for long-running procedures such as psychotherapy, it +could represent summary level information about overall progress. The +creation of a resource to support detailed real-time procedure information +awaits the identification of a specific implementation use-case to share such +information. + +For more information about the FHIR Procedure Request visit: https://www.hl7.org/fhir/procedurerequest.html +For further information about the FHIR Procedure visit: https://www.hl7.org/fhir/procedure.html diff --git a/medical_clinical_procedure/readme/CREDITS.md b/medical_clinical_procedure/readme/CREDITS.md new file mode 100644 index 00000000..6bd245e7 --- /dev/null +++ b/medical_clinical_procedure/readme/CREDITS.md @@ -0,0 +1,27 @@ +Images +------ + +* Clker-Free-Vector-Images: `Medical Icon `_ +* Odoo Community Association: `Odoo Icon `_. + +Contributors +------------ + +* Enric Tobella +* Roser Garcia +* Jordi Ballester + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/medical_clinical_procedure/readme/USAGE.md b/medical_clinical_procedure/readme/USAGE.md new file mode 100644 index 00000000..ca714ca1 --- /dev/null +++ b/medical_clinical_procedure/readme/USAGE.md @@ -0,0 +1,9 @@ +#. Go to 'Medical / Clinical / Requests / Procedure Requests' +#. Click 'Create'. +#. Fill in the information. +#. Click 'Save' and press the button 'Activate'. +#. To generate the according Procedure mark as complete the Procedure Request. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/159/11.0 diff --git a/medical_clinical_procedure/security/ir.model.access.csv b/medical_clinical_procedure/security/ir.model.access.csv index 95296f24..4077c9cc 100644 --- a/medical_clinical_procedure/security/ir.model.access.csv +++ b/medical_clinical_procedure/security/ir.model.access.csv @@ -3,4 +3,3 @@ medical_procedure_request_display,medical_procedure_request_display,model_medica medical_procedure_request_manager,medical_procedure_request_manager,model_medical_procedure_request,medical_base.group_medical_user,0,1,1,0 medical_procedure_display,medical_procedure_display,model_medical_procedure,medical_base.group_medical_user,1,0,0,0 medical_procedure_manager,medical_procedure_manager,model_medical_procedure,medical_base.group_medical_user,0,1,1,0 -access_procedure_request_make_procedure,access_procedure_request_make_procedure,model_procedure_request_make_procedure,medical_base.group_medical_user,1,1,1,0 diff --git a/medical_clinical_procedure/tests/test_procedure_request.py b/medical_clinical_procedure/tests/test_procedure_request.py index 02ef1393..a0f36202 100644 --- a/medical_clinical_procedure/tests/test_procedure_request.py +++ b/medical_clinical_procedure/tests/test_procedure_request.py @@ -2,7 +2,6 @@ # Copyright 2017 ForgeFlow # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -from odoo.exceptions import UserError, Warning as Warn from odoo.tests import TransactionCase @@ -13,38 +12,6 @@ def setUp(self): self.plan = self.browse_ref("medical_workflow.mr_knee") return res - def test_procedure(self): - procedure_requests = self.env["medical.procedure.request"].search( - [("patient_id", "=", self.patient.id)] - ) - self.assertEqual(len(procedure_requests), 0) - self.env["medical.add.plan.definition"].create( - {"patient_id": self.patient.id, "plan_definition_id": self.plan.id} - ).run() - procedure_requests = self.env["medical.procedure.request"].search( - [("patient_id", "=", self.patient.id)] - ) - self.assertGreater(len(procedure_requests), 0) - self.env["procedure.request.make.procedure"].with_context( - active_ids=procedure_requests.ids - ).create({}).make_procedure() - procedures = self.env["medical.procedure"].search( - [("procedure_request_id", "in", procedure_requests.ids)] - ) - self.assertEqual(len(procedure_requests), len(procedures)) - with self.assertRaises(UserError): - self.env["procedure.request.make.procedure"].with_context( - active_ids=procedure_requests.ids - ).create({}).make_procedure() - for request in procedure_requests: - self.assertEqual(request.procedure_count, 1) - with self.assertRaises(Warn): - request.unlink() - action = request.action_view_procedure() - self.assertEqual( - action["context"]["default_procedure_request_id"], request.id - ) - def test_procedure_request_workflow(self): request = self.env["medical.procedure.request"].create( {"patient_id": self.patient.id} diff --git a/medical_clinical_procedure/wizard/__init__.py b/medical_clinical_procedure/wizard/__init__.py deleted file mode 100644 index 47a5d5f5..00000000 --- a/medical_clinical_procedure/wizard/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2017 CreuBlanca -# Copyright 2017 ForgeFlow -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -from . import medical_procedure_request_make_procedure diff --git a/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure.py b/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure.py deleted file mode 100644 index 914a3376..00000000 --- a/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2017 CreuBlanca -# Copyright 2017 ForgeFlow -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -from odoo import _, exceptions, models - - -class ProcedureRequestMakeProcedure(models.Model): - _name = "procedure.request.make.procedure" - _description = "From Procedure Request Make Procedure" - - def make_procedure(self): - res = [] - active_ids = self.env.context.get("active_ids", []) or [] - for pr in self.env["medical.procedure.request"].browse(active_ids): - if pr.procedure_ids: - raise exceptions.Warning( - _("This Procedure Request already has a Procedure.") - ) - procedure = pr.generate_event() - res.append(procedure.id) - return { - "domain": "[('id','in', [" + ",".join(map(str, res)) + "])]", - "name": _("Procedure"), - "view_type": "form", - "view_mode": "tree,form", - "res_model": "medical.procedure", - "view_id": False, - "context": False, - "type": "ir.actions.act_window", - } diff --git a/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure_view.xml b/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure_view.xml deleted file mode 100644 index 9efeb924..00000000 --- a/medical_clinical_procedure/wizard/medical_procedure_request_make_procedure_view.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Procedure Request Make Procedure - procedure.request.make.procedure - -
- - -
-
- -
-
- - - Create Procedure - ir.actions.act_window - procedure.request.make.procedure - form - new - -