Altought Tryton correctly calculates both reports it is not possible to export both of them as a Printable Format (ODT or PDF).
This two reports are usually used to analyze the status of the company and they are often required by external entities. For example a bank when then company want’s to request a loan. For this reason I think it make sense to have a default print format to generate them.
In order to print this report we shold activate the print action on the Balance Sheet and Income Statement actions. I think both actions should print the full tree structure and do not require to mark all the records because it does not make sense to have any of this reports with the full structure. It should also be possible to print the amount and the comparision amount on the report. Last but not least, in order to be able to identifiy the context values (company, date, fiscalyear, etc.) used to print the report they should be printed on the header.
About the format I think we should use a generic format following the styles of the standard accounting reports letting the user customize the report to match it’s own style.
I don’t know what is the case for other countries but in Spain exists an official format of those reports as account_es and cia topic notes in accountability reports section so IMHO it deserves dedicated reports.
It would be good to know what happens for other countries in order to include them in the foundation code else at least eval them for account_es module.
Final user must present these reports to the authorities. Having included means an out-of-the-box product experience.
I do not agree. For me the CSV export is to allow the user pick the fields of the model he wants to export. But for the Balance Sheet and Profit and Loss reports the values to show are fixed:
Name
Amount
Comparision Amount (if requested)
I do not see why this may be usefull for other reports. Specialy for the initial line with the context, as we have a lot of values on the context that may not be relevant for the records. Furthermore, we store on the context the internal values (id of the fiscalyear) but we want to show to the user tha name of the fiscalyear.
IIUC the oficial reports are a model that determine the amount of information that should be exported but it is not a requirement to have exactly the same format. I’ve seen some reports of companies that use a diferent format (but with the same information). So I’m not sure if there is a strict requirement of having the same report.
So I think we can have a report that may be generic enought for all countries. We just need to show a table including the description of the periods in the header and all the concepts as list. Something like:
I mean that we have other information on the context that may be irrelevant for the report but we should include on the CSV header if we use a generic way.
Yes, the data is the same but there won’t be any header nor any footer on the CSV export. And I think it is important to have a proper header and footer for oficial document like balance sheet. For example, we may show on the header:
The title for the report (Balance Sheet or Income Statement)
The company name
The title of the columns with the date
And on the footer:
The page number (the report may fill up several pages so we must now if it is complete or not.)
Also the CSV export does not allow to customize the style which is important for some companies to produce more fancy reports: For example using diferent styles depending on the depth of the chart.
From what I understand what changes is the detail of the information. We have the same in Spain and we use two diferent charts to create a more detailed type structure. For big companies there are also more accounts required.
A report template does not work for tree structured data. That’s why those trees do not have.
I see no way to have a proper template on tree structured data except. Indeed what is expected a kind of print screen which is what CSV proposal tend to approach.
Or we need to have a list like representation of those reports.
Why not? You just need to pass the records in the proper order and then it just works. This is another reason to always export the full tree despite the selected reports. Here is some sample code that I used for the report:
ids = []
def add_childs(record):
ids.append(record.id)
for child in record.childs:
if child.statement != 'balance':
continue
add_childs(child)
for record in Type.search([
('company', '=', context['company']),
('statement', '=', 'balance'),
('parent.parent', '=', None),
]):
add_childs(record)
report_context['records'] = Type.browse(ids)
Then you can do loop the records variable and they will be printed in the parent/children order.
Completly agree. But here I think we are adding to much complexity when there is not so much. Let me explain:
Printing a tree structure (specially with partial nodes) is complex because you need to export the children of the selected records in the right order.
But when printing the Balance Sheet or the Profit and Loss it does not make sense to print a partial representation of the report because when you export those reports it’s because you want to share the full picture of your company with somebody else. That’s why I said:
The main issue here is that we use a tree structure for storing the data but on the report we should print them as a list of records. It will be great to add some way to diferentiate the depth of the tree (tabbing or diferent styles).
So for me the only way to do this is to create a report template that loads the records in the right order.
I think you want to have a generic way to export a tree using CSV files but I do not think this is the scope of this discussion.
I want a generic way to make a printable document based on tree structure expanded in the client.
I do not see the point to make special implementation (in standard) case by case when this is a generic needs. So as usual I prefer that Tryton is missing something than having a partial solution.
Do you have any other case in mind to export a tree structure expanded with the client?
For me having a generic solution to export Balance Sheet and Profit and loss using CSV will also be a partial solution because it will miss the following features:
It won’t be possible to customize the report on each instance. This is important because as companies my want to include it’s logo or use some diferent layout for the report. I’ve seen for example some companies that want to print an horitzontal Balance Sheet with the Assets on the left and the Liabilities on the right side.
It won’t be possible to convert the report to diferent formats. Some people prefer to have PDF files because they are not modificable.
When printing a CSV report it won’t have any header and footer printed per page.
The CSV will have a plain list of tree and it won’t be possible to diferentiate which records are child of another record.
Mainly an reporting as tree like the projects, the sale reporting based on a tree like category.
We have few in standard in part because we do not have such feature.
I’m not tide to CSV but it looks like a good place to start.
Internal reporting are not the main concern about customization because they are internal.
Any good spreadsheet program can export as PDF. And we could have an API to do that on server-side.
Already explained that the context will be the header.
This is not for only internal reporting but for external reporting. The reports should be sent to:
Banks when asking for a loan
Inverstors of the company
Why we need to reinvent the wheel if we already have format conversion for reports?
Using the rec_name will be a nightmare for accountants as it will print the full name of the tree for each item in the report. For the spanish chart of accounts this means printing:
Plan General Contable Español 2008\BALANCE NORMAL (PGCE 2008)\TOTAL ACTIVO (A + B)\A) ACTIVO NO CORRIENTE\IV. Inversiones en empresas del grupo y asociadas a largo plazo\1. Instrumentos de patrimonio
While the end user will expect only to see the last item: 1. Instrumentos de patrimonio