Tuesday, January 27, 2015

Documentation is getting better

More tidy-up routine work in the documentation.

There was yet another problem (“choicelists.get_by_name expected string”) due to a bug in lino.modlib.vat.Plugin.default_vat_class.

I finally created the plugin lino.modlib.office.

And yet another tutorial: /tutorials/addrloc/index.

And I moved the country_code setting from lino.modlib.vat to lino.modlib.countries.

Convert Partner to Person

Worked for #80 (Convert Partner to Person).

How to reproduce it:

  • go to the directory of lino.projects.min1

  • run initdb_demo and runserver

  • Create a Partner. Lino opens the detail window on that partner.

  • Check the “is Person” checkbox and click Save button.

  • Click the “(show)” link in order to see the person.

  • Fields first_name and last_name are empty.

The solution was rather complex and tricky:

  • The full_clean method of lino.modlib.contacts.models.Person now reacts if first_name and last_name are both empty and name is not empty. In that case it uses lino.modlib.contacts.utils.name2kw() to fill both fields.

  • lino.utils.mti.EnableChild now calls lino.utils.mti.insert_child() with the new keyword parameter full_clean. Which has the effect of calling full_clean on the new child.

  • New function lino.core.utils.error2str() with the side effect that messages caused by ValidationError are now reported in a more user-friendly way.