Tuesday, July 21, 2015

Service Report for Lino Noi

I converted the Service Report (lino.modlib.clocking) from a simple Report to a database model because I want to keep a history of the emitted service reports and because one day I’ll probably want to automatically send them to their recipient.

Side effects:

  • Discovered and fixed a bug: if a table had some numeric totals who caused a line of sums to be rendered, then the id column was also rendered with a sum (whose value was always “0”, but which was rendered).

  • I didn’t want ForeignKey fields in the pdf document to be clickable links.

  • Lino has now a Site.kernel.html_renderer which renders “simple” html instead of “bootstrap-style” html or “extjs-style” html. The most visible difference is that

TODO:

  • write documentation about stories, e.g. explain difference between:

    {{ar.story2html(obj.get_story(ar))}}
    

    and:

    {{ar.show(rt.models.clocking.ReportedTickets, obj, header_level=2)}}
    {{ar.show(rt.models.clocking.ReportedProjects, obj, header_level=2)}}
    
  • (cancelled) Make lino.modlib.clocking.models.ServiceReport inherit from ContactRelated and select the tickets based on the report’s recipient instead of manually filling a user into the interesting_for field.

Who is interested in tickets?

I had another enlightment… Lino Noi needs another database model lino.modlib.tickets.models.Site. And “interests” are not registered per user but per site.

Side effects:

  • I moved code from lino_welfare.modlib.welfare.fixtures.demo2 to a new fixture lino.modlib.excerpts.fixtures.demo2 so that this fixture is now also available for Lino Noi.

  • I inverted the order of permission check in get_bound_action_permission. This was possibly the cause for sporadic error messages like Cannot assign "<lino.modlib.users.utils.AnonymousUser object at 0x7f562512f210>": "Upload.user" must be a "User" instance when called by anonymous.

  • Updated documentation about Lino Noi (under Lino Noi Developer Guide).

Upgrade on The Lino framework

I upgraded the demo sites on The Lino framework and reinitialized the databases.

Sozialbuchhaltung

I continued on Accounting for Lino Welfare (#143).

Also nach einigen Wochen Pause tauche ich jetzt endlich mal wieder ins Projekt “Sozialbuchhaltung” ein. Im Reiter “Buchhaltung” eines normalen Partners haben wir VouchersByPartner und MovementsByPartner. Die obere Tabelle zeigt alle unregistrierten Partnerbelege, während die untere Tabelle alle registrierten Partnerbelege. Für Klienten aber interessiert uns das nicht (falls tatsächlich mal ein Klient auch als Lieferant fungiert und uns Rechnungen für andere Klienten ausstellt, ann schaltet man in die Ansicht als Partner oder als Person). Für Klienten muss der Reiter “Buchhaltung” diese beiden Tabellen pro Projekt zeigen.

Side effects:

  • When used in a tested document or a shell, ar.show until now ignored the fact that a slave table can have a summary panel and rendered a standard table for these. Now it renders the summary panel.

  • The above optimization unveiled a bug in Lino Polly which had slipped through the test suite until now but caused a failure in polls : managing questionnaires and responses now. I’ll never stop to excite about how big Lino is!

  • I discovered and fixed another bug which was there since 20150718 (Saturday, 18 July 2015): admin_main_base.html did not correctly display the welcome text for anonymous users because it was still testing on the authenticated attribute of UserProfiles (which I removed 20150718 (Saturday, 18 July 2015)). To fix this, I restored the lino.modlib.users.model.User.authenticated attribute on the User instance itself (not on the UserProfile)because in a template it would be difficult to test if user.profile.has_required_roles([SiteUser])