Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
17061 Lượt xem

I want to add company logo and address to the financial reports like profit & loss, balance sheet, etc

Where should i add the logo code so that it'll reflect in every report?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I have added the logo and address in report_financial.xml under the account_reports module as below

<template id="main_template">
<div class='o_account_reports_body'>
<div class="container o_account_reports_page o_account_reports_no_print">
<div>
<img src='/web/binary/company_logo' class="float-right" style="max-height: 65px; margin-top:20px;"
alt="Logo"/>
<span t-field="res_company.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/>
</div>
<hr></hr>
.....
.....
</div>
</div>
</template>

Thanks to Niyas Raphy for the answer ( https://www.odoo.com/forum/help-1/question/how-to-get-company-name-in-qweb-report-76684 ).

Ảnh đại diện
Huỷ bỏ

Great! So main_template helped you.

Tác giả

Yes Sudhir, it did :) Thanks though

This was really nice. I manged to put logo in partner ledger using the above code. thnks

Câu trả lời hay nhất

Hi Sameer,

You can find these reports in "account_reports" module. But there is no such internal layout in the module. 

The report is made up of web XML and the JS. 

I am not sure but check the template "main_template" in the "views/report_financial.xml" file and work around on this if you can pass the company image from the "account_report.py" file "get_html" method.

It is not that simple like qweb report. You need to do some R&D and work around to make it work.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for the input and yeah there's no layout in v12 so it shouldn't be as easy as it was done in v11. Will update if anything works out :)

Câu trả lời hay nhất

Hi,

What you can do is that change the internal_layout to external layout in the report. Once you change the report to to external_layout you will get the logo in header of the report.


For this activate the developer mode and navigate to Settings -> Technical -> Reporting -> Reports and search Financial Report. Then open the report and click the Qweb Views smart button in the top right and open that record. In the opening record in the Architecture tab you can see the code, in it 4th or 5th line you can see code like this,


<t t-call="web.internal_layout">


change this line to <t t-call="web.external_layout">



Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Niyas,

I can neither seem to find "Financial Report" under the Reporting -> Report menu nor the Actions -> Reports menu.

Which version you are using ? My explanation is based on odoo11

Tác giả

I'm using v12, any idea on where to find it in odoo 12 ? It would be even more beneficial if you told me how and where to change it using code so that we wouldn't have to worry about versions.

By default in odoo12 CE, accounting reports are not there, are you using third party modules or enterprise edition ?

Tác giả

Enterprise edition

Tác giả

where can i find these reports in code though? so i can modify it from there.

You will find these reports in "account_reports" module.

Tác giả

Hi Sudhir, I've looked it under account_reports/views/report_financial.xml but couldn't find any internal layout.

Tác giả

There is no external or internal layout defined whatsoever in version 12 so i don't think adding a logo to the report should be as easy as it was done in version 11.

Why negative vote ? Initially you haven't mentioned the version....

Tác giả

That wasn't me and if it makes you feel any better let me make it zero by up voting. Also FYI, I had the tag of odoov12 attached to the question right from the beginning.

didnt noticed the tag, thats why provided the solution in v11, as the accounting reports are not there in v12, assumed you might be v11, anyway happy to see you got solution

Tác giả

Your answer did provide me some insight and you answered fast so +1 for that and Keep up the good work Niyas :) Thanks again for the answer :D

It works. Thanks

Câu trả lời hay nhất
in 16 devmode->technical -->views-->find main_template ,, 
it will be account_reports.main_template
in that after warnings_div
  


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 24
1588
1
thg 3 19
7726
1
thg 3 15
5020
0
thg 7 22
3613
4
thg 6 20
4260