Rewrite linekey handling in register

Also: simplify bufferline updates, check permission on "no sale", change
modifier key check to work on unit types rather than departments.
Model bugfixes

The backref from transaction to user should not have the 'delete'
cascade option set.  The default (set to NULL) is required, otherwise
deleting a transaction will also mark the user for deletion.
Expire used/sold/remaining properties on stockitems after change
Fix "repeated key" detection at start of transaction
Show remaining items as an integer