health
[Top][All Lists]
Advanced

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

Re: [Health] Error on Third Update


From: Carlos Eduardo Sotelo Pinto
Subject: Re: [Health] Error on Third Update
Date: Tue, 13 Dec 2016 07:07:38 -0500

Extra information

2016-12-13 5:23 GMT-05:00 Carlos Eduardo Sotelo Pinto <address@hidden>:
Comunity

I have foind an dissue trying to update an existing patient or health professional information.

The error is related to the given name field that is requested but there is no way to fill ( at least I have no found a way to set it )

Sequence

1. Pick a patient
2. Change a letter on the name
3. Save
4. Error appear

1. Pick a health professional
2. Change a letter on the name
3. Save
4. Error appear

On my local the error appear on this way

​File "/tryton/trytond/trytond/modules/health/health.py", line 477, in write
    cls.update_person_official_name(person_id,given_name,
UnboundLocalError: local variable 'given_name' referenced before assignment




On comunity server appear a windows alerting that given name is no set




 

--
Carlos Eduardo Sotelo Pinto
    Senior Software Developer
    Movil: +51 989550602
    Skype: csotelop

Please consider the environment before printing this email
Join the campaign at http://thinkBeforePrinting.org


@classmethod
    def write(cls, *args):
        actions = iter(args)
        args = []
        for parties, vals in zip(actions, actions):
            vals = vals.copy()
 
            person_id = parties[0].id
            # We use this method overwrite to make the fields that have a
            # unique constraint get the NULL value at PostgreSQL level, and not
            # the value '' coming from the client
            if vals.get('ref') == '':
                vals['ref'] = None
 
            if 'photo' in vals:
                vals['photo'] = cls.convert_photo(vals['photo'])
           
            if ('name' in vals) or ('lastname' in vals):
                given_name=family_name=''
                if 'name' in vals:
                    given_name = vals['name']
                if 'lastname' in vals:
                    family_name=vals['lastname']
 
            if (vals.get('is_person')):
                cls.update_person_official_name(person_id,given_name,
                    family_name)
 
            args.append(parties)
            args.append(vals)
        return super(PartyPatient, cls).write(*args)


​There is somethimng like if (vals.get('is_person')): but this param just been filled if the "is_person" field changed on an existing record, otherwise, always will be null and cls.update_person_official_name(person_id,given_name,family_name) will be broken.

I was trying to find a way to ovewrite that method, how as the return call parent, allways health.health.PartyPatient will be called and update person will fail



--
Carlos Eduardo Sotelo Pinto
    Senior Software Developer
    Claro RPC +51 989550602
    GTalk: address@hidden | Skype: csotelop
    GNULinux RU #379182 | GNULinux RM #277661

Please consider the environment before printing this email
Join the campaign at http://thinkBeforePrinting.org

reply via email to

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