[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Health-dev] [bug #63959] AttributeError: 'gnuhealth.patient' Model has
From: |
Mathias Behrle |
Subject: |
[Health-dev] [bug #63959] AttributeError: 'gnuhealth.patient' Model has no attribute 'age' |
Date: |
Fri, 24 Mar 2023 05:59:08 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?63959>
Summary: AttributeError: 'gnuhealth.patient' Model has no
attribute 'age'
Group: GNU Health
Submitter: yangoon
Submitted: Fri 24 Mar 2023 09:59:06 AM UTC
Category: Functionality
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Release: None
Discussion Lock: Any
Module: health
Component: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 24 Mar 2023 09:59:06 AM UTC By: Mathias Behrle <yangoon>
This error raises when creating an evaluation with an unsaved patient:
Traceback (most recent call last):
File "/.local/lib/python3.7/site-packages/trytond/model/model.py", line 368,
in _getitem
return getattr(self, field)
AttributeError: age
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/.local/lib/python3.7/site-packages/trytond/model/model.py", line 291,
in __getattr__
return self._values[name]
File "/.local/lib/python3.7/site-packages/trytond/model/model.py", line 370,
in _getitem
raise KeyError(field)
KeyError: 'age'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/.local/lib/python3.7/site-packages/trytond/wsgi.py", line 117, in
dispatch_request
return endpoint(request, **request.view_args)
File "/.local/lib/python3.7/site-packages/trytond/protocols/dispatcher.py",
line 47, in rpc
request, database_name, *request.rpc_params)
File "/.local/lib/python3.7/site-packages/trytond/wsgi.py", line 84, in
auth_required
return wrapped(*args, **kwargs)
File "/.local/lib/python3.7/site-packages/trytond/protocols/wrappers.py",
line 159, in wrapper
return func(request, pool, *args, **kwargs)
File "/.local/lib/python3.7/site-packages/trytond/protocols/dispatcher.py",
line 185, in _dispatch
result = rpc.result(meth(inst, *c_args, **c_kwargs))
File "/.local/lib/python3.7/site-packages/trytond/model/modelview.py", line
88, in wrapper
result = func(self, *args, **kwargs)
File "/.local/lib/python3.7/site-packages/trytond/model/fields/field.py",
line 123, in wrapper
return func(self, *args, **kwargs)
File "/.local/lib/python3.7/site-packages/trytond/modules/health/health.py",
line 5019, in on_change_patient
self.computed_age = self.patient.age
File "/.local/lib/python3.7/site-packages/trytond/model/modelstorage.py",
line 1485, in __getattr__
return super(ModelStorage, self).__getattr__(name)
File "/.local/lib/python3.7/site-packages/trytond/model/model.py", line 294,
in __getattr__
% (self.__name__, name, self._values))
AttributeError: 'gnuhealth.patient' Model has no attribute 'age':
<trytond.model.model.gnuhealth.patient._record object at 0x7fb4e6f1d208>
While it is in currently not possible to create evaluations outside of a
patient domain in Standard GNU Health (thus always requiring to save the
patient beforehand) the model should nevertheless work in different contexts.
A quick fix is to skip the evaluation of unavailable properties with
@fields.depends('patient')
def on_change_patient(self):
if self.patient.id > 0:
...
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63959>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Health-dev] [bug #63959] AttributeError: 'gnuhealth.patient' Model has no attribute 'age',
Mathias Behrle <=