Hi Mario On Wed, 17 May 2017 16:46:06 -0400 Mario Castro Squella <mcas...@registrar.cl> wrote:
> Thanks Luis for the tip, but I still can’t achieve exactly what I > want. > > I want to fetch all specialties by querying the gnuhealth.specialty > model. The Tryton API will give me a list with their rec_name and > IDs. I’m creating a web app for setting up appointments and I want to > get a list of doctors by specialty. I might not be getting your point... The Reporting -> Specialties by Health Professionals should give you the list. >I thought that the specialties > list with the specialty IDs I get when I query for a health > professional would correspond to the specialty ID, but after > inspecting the module code I see these IDs correspond to an > intermediate model gnuhealth.hp_specialty since the health > professional to specialty relationship is a Many2Many relationship. The health professional specialties is a One2Many relationship. > To summarize: how can I get a list of health professionals that have > a given specialty using Tryton’s domain syntax? > The action "gnuhealth_action_hp_specialty" is the easiest way. Remember that one health professional can have more than one specialty. Bests, Luis > Once again, thanks :) > > Mario Castro Squella > Ingeniero de Software | Registrar SW <http://www.registrar.cl/> > +56 9 9702 8116 > > > El 17-05-2017, a las 06:18, Luis Falcon <fal...@gnu.org> escribió: > > > > Hi Mario > > > > On Tue, 16 May 2017 18:42:23 -0400 > > Mario Castro Squella <mcas...@registrar.cl> wrote: > > > >> Hello everyone, I’m new to Tryton and its API so I’ll explain what > >> I’ve been trying to achieve without success: > >> > >> I’m querying HealthProfessional tomcas...@registrar.cl get all > >> health professionals but then I would like to filter, or separate, > >> depending on their occupation (separate doctors from nurses, > >> etc.). The results I get from querying HealthProfessionals don’t > >> give me information regarding the related Party occupation. > >> Looking at the code I see that HealthProfessional has a Many2One > >> relationship with the Party model, which has an occupation ID. I > >> would like to do a simple join of the two tables using the domain > >> so that way I get the health professional’s correct ID but also > >> its occupation ID, with which I can use then to filter. Any help > >> with this will be appreciated. :) > > > > Check the menu "Specialties by Healh Professionals". There you can > > filter by specialty / branch in medicine and healh sciences at > > large, and get the list of matching health professional > > > > The occupation at Party level is generic, not only for health > > sciences but for different fields. It's the current occupation / > > job of a particular person. > > > > Bests, > > > >> > >> Thanks, > >> > >> Mario Castro Squella > >> Ingeniero de Software | Registrar SW <http://www.registrar.cl/> > >> +56 9 9702 8116 > >> > > > > > > > > -- > > Dr. Luis Falcon, M.D., BSc > > President, GNU Solidario > > GNU Health: Freedom and Equity in Healthcare > > http://health.gnu.org > > GNUPG Fingerprint :ACBF C80F C891 631C 68AA 8DC8 C015 E1AE 0098 > > 9199 >