:date: 2017-06-16 ===================== Friday, June 16, 2017 ===================== I checked in my yesterday's work on :ticket:`1906`. Then continued on :ticket:`1907` (Lino zeigt keine Konten an in EKR). This is caused by the :meth:`get_allowed_accounts ` method. The only problem is that no account had its `lino_xl.lib.accounts.Account.purchase_allowed` checkbox checked. The fundamental challenge is here: How to make these fields visible in a flexible way? Current solution (which is reasonable but not perfect) is that I defined a custom layouts module for Lino Tera (:mod:`lino_tera.lib.tera.layouts`). This solution is not perfect because this layout is probably used by all applications which have both :mod:`lino_xl.lib.accounts` and :mod:`lino_xl.lib.ledger`. The solution for this would be to define these layouts as part of the Cosi project and to have Tera, Voga, Presto etc inherit the accounts plugin from Cosi. But I am not doing this right now because of a licensing problem: Lino Cosi is GPL licensed (not BSD) because the :mod:`lino_xl.lib.b2c` plugin contains GPL licensed code from Odoo and AFAICS I am not allowed to publish my derivated work under the BSD. The name field of a partners list ================================= I discovered that there is a problem, probably caused by our move to Django 1.11 : when Lino Tera writes a database snapshot, the generated :xfile:`restore.py` fill currently has:: def create_lists_list(partner_ptr_id, ref, list_type_id): #return create_mti_child(contacts_Partner, partner_ptr_id, lists_List,ref=ref,list_type_id=list_type_id,name_fr=name_fr) return create_mti_child(contacts_Partner, partner_ptr_id, lists_List,ref=ref,list_type_id=list_type_id,name=ref) which causes a runtime error "UndefinedName `name_fr`". For example in Lino Vilma it doesn't occur:: def create_lists_list(id, ref, name, list_type_id, remarks): kw = dict() kw.update(id=id) kw.update(ref=ref) if name is not None: kw.update(bv2kw('name',name)) kw.update(list_type_id=list_type_id) kw.update(remarks=remarks) return lists_List(**kw) This might be a serious problem which might cause data loss. I created :ticket:`1908`. I guess that it related to the fact that the `lists.List` model in Lino Tera also inherits from Partner:: class List(List, Partner): ... An in that case the problem had even been detected by two test cases :ref:`lino.tested.diamond` and :ref:`lino.tested.diamond2`. I deactivated them last week because I didn't see that they are important. Now I see that they are. The erroneous code is generated by :cmd:`pm dump2py`. I moved the relevant code into a function :func:`write_create_function ` so that I can import it for writing testable docs: >>> from lino import startup >>> startup('lino_book.projects.lydia.settings.demo') >>> from lino.modlib.lino_startup.management.commands.dump2py import write_create_function >>> import sys >>> from lino.api import rt >>> write_create_function(rt.models.lists.List, sys.stdout) def create_lists_list(partner_ptr_id, ref, list_type_id): return create_mti_child(contacts_Partner, partner_ptr_id, lists_List,ref=ref,list_type_id=list_type_id,name_de=name_de,name_fr=name_fr) See also :func:`lino.utils.dpy.create_mti_child`