20130123

Merge two database rows (continued)

I integrated MergeAction into the changes history framework which now logs a new change type “Merge”, and every merge of a watched object.

If I merge a client A to another client B, then A gets deleted, but the change history is transferred to A.

In lino.modlib.contacts.fixtures.demo, added two new fictive persons Dorothée Dobbelstein and Dorothée Dobbelstein-Demeulenaere who are accidental duplicates of the existing Dorothée Demeulenaere. Try to merge them!

I also converted the changes framework to use signals, which makes the whole thing more clear: The new lino.modlib.changes module is to be added to INSTALLED_APPS, and the application startup code must somewhere call lino.modlib.changes.models.watch_changes() on the models to be observed.

log_delete now stores a last image of the object .

To observe:

  • Change.object_id should maybe better not be modified in order to show that this change was on an object instance which no longer exists. I added a new attribute dont_merge to lino.core.fields.GenericForeignKey specially for this.

  • In general this new feature is to be considered unstable and should not yet be used on real data.

Miscellaneous

  • virtual price fields weren’t right aligned in plain html because VirtStoreField forgot to take apply_cell_format from the delegate

  • lino_welfare.modellib.debts.models.DistByBudget was editable although it defines its own get_data_rows. That was because it inherits from lino_welfare.modellib.debts.models.EntriesByBudget which has no get_data_rows, and because lino.core.tables.AbstractTable.class_init() over-eagerly set it from None to False in that case.

  • lino_welfare.modellib.debts.models.PrintEntriesByBudget now also shows the original amounts for entries with periods other than 1