Hello everyone,
It was develop a module (party_ruc_pe) which adds the identifiers fields (Tipo documento, Codigo documento) to party form view in order to get some data like name, address and add a record to Identifiers tab as shown on the next picture:
In version 4.2 it works fine, but now that it has been upgraded to version 5.0 the following error is thrown:
Traceback (most recent call last):
File "/trytond/model/model.py", line 396, in __getattr__
return self._values[name]
KeyError: '_changed_values'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/trytond/wsgi.py", line 73, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 46, in rpc
request, database_name, *request.rpc_params)
File "/trytond/wsgi.py", line 44, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 122, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(inst, *c_args, **c_kwargs))
File "/trytond/model/modelview.py", line 709, in on_change
return [self._changed_values]
File "/trytond/model/modelstorage.py", line 1281, in __getattr__
return super(ModelStorage, self).__getattr__(name)
File "/trytond/model/model.py", line 399, in __getattr__
% (self.__name__, name, self._values))
AttributeError: 'party.party' Model has no attribute '_changed_values': {'document_code': '10762992979', 'name': 'ROMERO ALMONTE YOEL DIOMEDEZ', 'type': 'pe_vat', 'addresses': (Pool().get('party.address')(**{'active': True, 'city': '', 'country': 176, 'delivery': False, 'district': 6356, 'google_maps_url': 'http://maps.google.com/maps?hl=es&q=%2C%20Lima%2CPER%C3%9A', 'invoice': True, 'name': '', 'party_name': '', 'province': 4963, 'sequence': None, 'street': '', 'subdivision': 2223, 'ubigeo': '150101', 'zip': ''}),), 'identifiers': (Pool().get('party.identifier')(**{'party': -1, 'code': '10762992979', 'type': 'pe_vat'}),), 'message': 'Documento válido'}
So, debugging the module, it was found that the code line that causes the error is: self.identifiers = tuple(aux_identifiers)
and this line is the one that adds the record to Identifiers tab. And well, I was wondering:
- if there’s a way to rewrite that line to make it work in version 5.0 and how would it be?
- Why this happens, though?