20130912 (Thursday, 12 September 2013)¶
Printing mail labels¶
Until now the “Show this table as a pdf document” action was implemented
in linoweb.js
and lino.ui.views
.
Now I converted it to a “real” action
PdfTableAction
.
Because I wanted to know whether Lino can do it.
He can. Congratulations!
This has several advantages:
The mechanism is no longer split across several files but all in one place.
Added new file Table-portrait.odt, almost the same as Table.odt. Applications can override the default PdfTableAction in order to use this portrait version:
class Countries(dd.Table): ... as_pdf = PdfTableAction(template_name = "Table-portrait.odt")
TODO: Now I’ll also want to convert the html, csv and delete actions. The delete action is most urgent because users cannot delete multiple rows at once.
But first I have another idea for a third advantage of this:
I wrote a derived class
PrintLabelsAction
and a template
/lino/config/Labels.odt,
and added this to contacts.Partner.
Bingo.
Except for a little detail: it prints only one page of labels.
Removed the lino.site.Site
methods
get_letter_margin_top
and
get_letter_margin_bottom
and replaced them by two templates
letter_margin_top.html
and
letter_margin_bottom.html