We perform obligations to obtain information about our beneficial owners.
Small introductory
Starting from December 21, 2016, amendments to the Federal Law of the Russian Federation “On Counteracting Legalization (Laundering) of Proceeds from Crime and Financing of Terrorism” entered into regarding the obligation of a legal entity to disclose information about its beneficial owners. In this regard, many companies send inquiries along the chain of ownership in order to ascertain their beneficial owners. Someone makes requests on paper, someone sends emails.
In our opinion, the proper proof of fulfillment of the duty “know your beneficiary owner” is the presence of a letter on paper with a mark of dispatch / delivery. These letters should ideally be prepared at least once a year. If a lawyer is in charge of only a few companies, then drawing up letters is not difficult. But, if there are more than 3 dozen companies, composing letters turns into a positively annihilating routine. The matter is aggravated by the fact that the details of the letters are constantly changing: the signatories are dismissed, companies are re-registered by changing addresses. All this must be taken into account. How can python programming skills help here?
It is very simple - it would be nice to have a program that itself will substitute necessary details into letters. Including form the letters themselves, without forcing to create a document by document manually. Let's try.
The structure of the letter in the word. Python docxtpl module
Before writing the program code, let's see how the letter template should look like, into which we will place our data.
')
The text of the letter from the company to its member / shareholder will be approximately as follows:

We will write a simple program that will fill in one field in our template to begin with, in order to understand the principle of operation.
To begin with, in the Word letter template itself, instead of one of the fields, for example, the signer, we set a variable. This variable must be either in English. language, or in Russian, but in one word. Also, the variable must be enclosed in double curly braces. It will look something like this:

The program itself will have the following form:
from docxtpl import DocxTemplate doc = DocxTemplate(".docx") context = { 'director' : ".."} doc.render(context) doc.save("-final.docx")
First we import the module for working with Word documents. Next, we open the template, and in the field director, which would have been designated earlier in the template itself, we enter the full name of the director. At the end, the document is saved under a new name.
Thus, in order to fill in all the fields in the Word template file, we first need to define all the input fields in the template itself with {} brackets along with the variables and then write the program. The code will be approximately as follows:
from docxtpl import DocxTemplate doc = DocxTemplate(".docx") context = { 'emitent' : ' ', 'address1' : '. , . , . 0', '': ' ', '_': '. , . , . 0', 'director': '.. '} doc.render(context) doc.save("-final.docx")
At the exit during the execution of the program, we will receive a completed document.
Download the ready-made Word template
here .