Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
8667 Tampilan

I have created two files 'fileone.css' and 'filetwo.scss'. they have styles for my template to generate a PDF report in sales app.

I want to add these two style files to the "assets" in the "__manifest__".

the pb is I don't know where to put them. there is 2 assets: 

'web.report_assets_common'  and 'web.report_assets_pdf'.

which one I should pick ?


'assets': {
'web.report_assets_common': [
'/my_addons/static/src/scss/filetwo.scss',
'/my_addons/static/src/css/fileone.css',
],
'web.report_assets_pdf': [
'/my_addons/static/src/scss/filetwo.scss',
'/my_addons/static/src/css/fileone.css',
],
},


Anyone could help?

Thanky you in advance.
Avatar
Buang
Jawaban Terbai

The choice between 'web.report_assets_common' and 'web.report_assets_pdf' in the Odoo manifest depends on whether the styles you've defined in 'fileone.css' and 'filetwo.scss' are intended for general web viewing or specifically for PDF reports.

Here's a brief explanation of each:
1.web.report_assets_common:

  • This asset is for styles that affect the appearance of reports when viewed in the web interface.
  • Styles defined here will be applied to reports when users view them within the Odoo application.

'assets': {

    'web.report_assets_common': [

        '/my_addons/static/src/scss/filetwo.scss',

        '/my_addons/static/src/css/fileone.css',

    ],

},


  1. 2.web.report_assets_pdf:
    • This asset is specifically for styles that should be applied when generating PDF reports.
    • Styles defined here will be used when you print or download a report as a PDF.

'assets': {

    'web.report_assets_pdf': [

        '/my_addons/static/src/scss/filetwo.scss',

        '/my_addons/static/src/css/fileone.css',

    ],

},

Decision:

  • If the styles are intended for both web viewing and PDF reports, you might include them in both assets.
  • If the styles are only intended for PDF reports, use 'web.report_assets_pdf'.
  • If the styles are only intended for web viewing, use 'web.report_assets_common'.

In most cases, if the styles are generic and applicable to both web and PDF, it's a common practice to include them in 'web.report_assets_common'. However, if you want more control or separation between web and PDF styles, you can use both assets accordingly.


Avatar
Buang
Jawaban Terbai

Hi,

1. web.reports_assets_common


This speaks about the common resources that Odoo uses for its web-based reports. on Odoo, reports are frequently created and displayed on a web interface. These reports may contain a variety of assets, including JavaScript files, CSS stylesheets, and other resources needed for proper report rendering. 

2. web.report_assets_pdf

 This phrase probably has something to do with creating PDF reports in Odoo. With Odoo, you can create PDF versions of many system reports and documents.
This can contain the materials needed to design the layout, style the PDF output, and guarantee that the content is accurately converted to PDF format.

The main difference is report_assets_common affected on both web view and pdf view while report_assets_pdf does not affected on web view.


Hope it helps

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Sep 23
2704
1
Jun 19
4091
0
Nov 23
1948
0
Nov 23
1473
1
Jul 25
4288