Tuesday, April 22, 2014¶
Working on docs/tickets/93.
“Must read eID card” action in newcomers.NewClients¶
Fixed the bug (discovered yesterday) on the “Must read eID card” action link in newcomers.NewClients.
This was indeed because the action is being called using pcsw/Clients instead of pcsw/NewClients as URI.
The action link is generated (by the eid_info virtual field defined
on BeIdCardHolder
)
using the following code:
msg = _("Must read eID card!")
ar.instance_action_button(self.read_beid, msg, icon_name=None)
The culprit was
lino.modlib.extjs.ext_renderer.ExtRenderer.action_call_on_instance()
who ignored that ba.actor may differ from ar.actor when defined on
a different actor.
global name ‘Answers’ is not defined¶
Also fixed a bug in lino.modlib.polls
which caused an
Internal Server Error “global name ‘Answers’ is not defined” in Lino Polly when
a Response was being displayed. Note that Lino Polly is still not
usable after adding support for multiple choices. The
select_by_response action doesn’t yet work.
Preventing duplicate person records¶
Cool: Yesterday I just used a dummy example of a possible callback confirmation: “Is that true? Your name is ‘Foo’?” Now I wrote the real action. And it was really easy:
qs = dedupe.SimilarPersons.find_similar_instances(obj)
if qs.count() > 0:
msg = _(
"There are %d clients with similar name:") % qs.count()
for other in qs[:4]:
msg += '<br/>' + unicode(other)
msg += '<br/>' + _("Are you sure you want to create a new "
"client named %s?") % obj.get_full_name()
ar.confirm(ok, msg)
I also optimized in our
find_similar_instances
method, which continues to be rather simplistic.
Added test cases in The lino_welfare.modlib.pcsw plugin.
Started to try to get the welfare test suite repaired. But after some hours I decided that for the moment this would be inefficient because many tests are still going to change.
Multiple addresses per Client¶
Started to work on the next item of docs/tickets/93: multiple client addresses.
It is the first time that we want SubmitInsert to not switch to detail window.
It seems that we need a concept of “edit mode”, that is, a new url parameter to add to the AJAX call, so that the action can know whether it was called from a grid or from a detail.
Also added new Actor attribute stay_in_grid.
Checkin.
TODO: After click on “primary address”, Lino now closes the detail window and displays that address’s detail.