Saturday, January 10, 2015

Termin erstellen für Klient ohne Begleitung

Working for #55

Yesterday I noticed that after creating an appointment, the client is not automatically added as a Guest to that appointment.

The basic problem was in

def suggest_guests(self):
    if self.owner:
        for obj in self.owner.suggest_cal_guests(self):
            yield obj

It’s not enough to ask only the owner. Manually created events don’t have an owner. But in Lino Welfare, even for manually created events we have EventType.invite_client which means that the Event.project (which always is a Client in Lino Welfare) should be suggested as Guest.

A second problem was that Lino did not “automatically click the lightning button” on a newly created event. So I added an after_ui_created method to get this. Similarily to what we had already for Household.

This causes the number of cal.Guest in the demo databases to increase because all isip.Contract and job.Contact now also get their Client as a Guest. The total number of guests in increases from 616 to 1042. Which needed two changes in Welfare’s test suite:

  • lino_welfare/projects/docs/tests/
  • docs/tested/general.rst

I moved to documentation in back to the source code. See

Note: I also tried to convert into a package, but this caused “the hell to break loose”, as Andrew Cooke explained already 2009 in a post titled Using a Directory (Package) for Django’s Model.