[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Health-dev] Error creating new people

From: Francisco Maria Moyano Casco
Subject: [Health-dev] Error creating new people
Date: Thu, 21 Mar 2019 20:37:40 -0300

There is an error on on health_federation module, on default_node() function

    def default_node():
        # Get the Institution code as the originating node.
        HealthInst = Pool().get('gnuhealth.institution')
        institution = HealthInst.get_institution()       
        institution_code, = HealthInst.search_read([("name", "=", institution)],
            limit=1, fields_names=['code'])
        return institution_code['code']

On the highlighted line, it should be
institution_code, = HealthInst.search_read([("id", "=", institution)],

It works ok on almost all implementation, because when you first run gnuhealth, the wizard makes you create a company related to a party (the first party on the database with id=1).
Then, when you create an institution related to that party (id=1), it will work fine, because the parameter name will be equal to institution variable returned from the staticfunction get_institution (id of the institution related to your party company)

BUT, when you choose another party to relate to your company, the party['id'] != institution['id'], so you will get an error.

It is a silent code error, so not everyone will notice, unless you choose another party for your company.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]