Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

Lino Tera : miscellaneous

Side note: Code snippets (lines starting with >>>) in this document get tested as part of our development workflow. The following initialization snippet tells you which demo project is being used in this document.

>>> from lino import startup
>>> startup('lino_book.projects.tera1.settings.doctests')
>>> from lino.api.doctest import *
>>> from django.db import models

Every Lino Tera application has a settings.py module that inherits from lino_tera.lib.tera.settings.

>>> from lino_tera.lib.tera.settings import Site
>>> isinstance(settings.SITE, Site)
True

Lino Tera does not have multiple addresses per partner.

>>> dd.is_installed('addresses')
False

Partner types

>>> dd.plugins.contacts
<lino_tera.lib.contacts.Plugin lino_tera.lib.contacts(needs ['lino_xl.lib.countries', 'lino.modlib.system'])>
>>> print([m.__name__ for m in rt.models_by_base(rt.models.contacts.Partner)])
['Company', 'Partner', 'Person', 'Household', 'Client']
digraph foo {
  "Partner" -> "Organization"
  "Partner" -> "Person"
  "Partner" -> "Household"
}

Activities

>>> print(settings.SITE.project_model)
<class 'lino_tera.lib.courses.models.Course'>

Teams

>>> rt.show(teams.Teams)
=========== ============= ================== ==================
 Reference   Designation   Designation (de)   Designation (fr)
----------- ------------- ------------------ ------------------
 E           Eupen
 S           St. Vith
=========== ============= ================== ==================

The following just repeats on the first payment order what has been done for all orders when lino_xl.lib.finan.fixtures.demo generated them:

>>> ses = rt.login()
>>> obj = rt.models.finan.PaymentOrder.objects.first()
>>> obj
PaymentOrder #87 ('PMO 1/2015')
>>> rv = obj.write_xml.run_from_session(ses)  
xml render <django.template.backends.jinja2.Template object at ...> -> .../media/xml/xml/finan.PaymentOrder-87.xml ('en', {})
Validate .../media/xml/xml/finan.PaymentOrder-87.xml against .../lino_xl/lib/finan/XSD/pain.001.001.02.xsd ...
>>> rv['success']
True
>>> print(rv['open_url'])
/media/xml/xml/finan.PaymentOrder-87.xml

Let’s check whether the XML file has been generated and is a valid SEPA payment initiation:

>>> fn = settings.SITE.site_dir / rv['open_url'][1:]
>>> fn.exists()
True
>>> from lino_xl.lib.finan.validate import validate_pain001
>>> validate_pain001(str(fn))

Voucher types

>>> rt.show(accounting.VoucherTypes)
... 
=============================== ====== ================================================================ ========================================================
 value                           name   text                                                             Model
------------------------------- ------ ---------------------------------------------------------------- --------------------------------------------------------
 ana.InvoicesByJournal                  Analytic invoice (ana.InvoicesByJournal)                         <class 'lino_xl.lib.ana.models.AnaAccountInvoice'>
 bevats.DeclarationsByJournal           Special Belgian VAT declaration (bevats.DeclarationsByJournal)   <class 'lino_xl.lib.bevats.models.Declaration'>
 finan.BankStatementsByJournal          Bank Statement (finan.BankStatementsByJournal)                   <class 'lino_xl.lib.finan.models.BankStatement'>
 finan.JournalEntriesByJournal          Journal Entry (finan.JournalEntriesByJournal)                    <class 'lino_xl.lib.finan.models.JournalEntry'>
 finan.PaymentOrdersByJournal           Payment Order (finan.PaymentOrdersByJournal)                     <class 'lino_xl.lib.finan.models.PaymentOrder'>
 trading.InvoicesByJournal              Sales invoice (trading.InvoicesByJournal)                        <class 'lino_xl.lib.trading.models.VatProductInvoice'>
 vat.InvoicesByJournal                  Invoice (vat.InvoicesByJournal)                                  <class 'lino_xl.lib.vat.models.VatAccountInvoice'>
=============================== ====== ================================================================ ========================================================
>>> # rt.show(accounting.Journals, filter=models.Q(must_declare=True))

Internal details

The following shows that #1975 is a duplicate of #492:

>>> a = rt.models.ana.InvoicesByJournal._actions_dict.get('wf1')
>>> a.action.auto_save
True

Technical stuff (don’t read)

Verify whether we can select an invoice_recipient on a client. It’s an editable remote field.

>>> base = "/choices/tera/Clients/salesrule__invoice_recipient"
>>> show_choices("robin", base + '?query=')  
<br/>
AS Express Post
AS Matsalu Veevärk
Alliance nationale des mutualités chrétiennes
Altenberg Hans
Arens Andreas
Arens Annette
...
van Veen Vincent
Ärgerlich Erna
Õunapuu Õie
Östges Otto
>>> rt.show("excerpts.ExcerptTypes")
... 
============================================================== ========= ============ ==================== ====================== ====================== ===================== ============================= ===============
 Model                                                          Primary   Certifying   Designation          Designation (de)       Designation (fr)       Print method          Template                      Body template
-------------------------------------------------------------- --------- ------------ -------------------- ---------------------- ---------------------- --------------------- ----------------------------- ---------------
 `bevats.Declaration (Special Belgian VAT declaration) <…>`__   Yes       Yes          VAT declaration      MwSt.-Erklärung        VAT declaration        WeasyPdfBuildMethod   default.weasy.html
 `contacts.Partner (Partner) <…>`__                             No        No           Payment reminder     Zahlungserinnerung     Rappel de paiement     WeasyPdfBuildMethod   payment_reminder.weasy.html
 `contacts.Person (Person) <…>`__                               No        No           Terms & conditions   Nutzungsbestimmungen   Conditions générales   AppyPdfBuildMethod    TermsConditions.odt
 `courses.Enrolment (Enrolment) <…>`__                          Yes       Yes          Enrolment            Einschreibung          Inscription
 `finan.BankStatement (Bank Statement) <…>`__                   Yes       Yes          Bank Statement       Kontoauszug            Extrait de compte
 `finan.JournalEntry (Journal Entry) <…>`__                     Yes       Yes          Journal Entry        Diverse Buchung        Opération diverse
 `finan.PaymentOrder (Payment Order) <…>`__                     Yes       Yes          Payment Order        Zahlungsauftrag        Ordre de paiement
 `sheets.Report (Accounting Report) <…>`__                      Yes       Yes          Accounting Report    Buchhaltungsbericht    Accounting Report      WeasyPdfBuildMethod
 `trading.VatProductInvoice (Sales invoice) <…>`__              Yes       Yes          Sales invoice        Verkaufsrechnung       Sales invoice
============================================================== ========= ============ ==================== ====================== ====================== ===================== ============================= ===============