Thursday, July 23, 2015

How to change qweb report file name when downloaded

Currently, when downloaded report, file name is always default as report_name.
This module help you get report_file as downloaded file name.
Please refer:
      https://github.com/tranchiendang/odoo_report_change_downloaded_file_name

Wednesday, July 15, 2015

create user or role

Confuse with create database user, just run this command:
   createuser --createdb --username postgres --no-createrole --pwprompt test

Thursday, July 9, 2015

how to run a function at the time installation module

If you want to run a specific function, before install the module, example, re-update current data,
so add a line to define action pre_init_hook to file __openerp__.py like this:
     'pre_init_hook': 'function_A'

Tuesday, July 7, 2015

qweb report not changing after modification xml

If you meet this case, to resolve it, move to Setting / Technical / Actions / Reports
Edit report, and then uncheck on field: Reload from Attachment

Sunday, July 5, 2015

span: align text

when I need to align text in span tag, I usually use as below:
     <span style="float: right; text-align: right;" />

How to know the postgresql data directory

If you want to know, the path of postgresql's data, just login to psql cli, and run this command:
    SHOW data_directory;
and then you can get the path.

qweb report - embedded your image to report

Sometimes, when you need to custom your report header, add another image as logo, as usual, if you add image with path as
    <img src="/addons/module/script/src/images/a.jpg" />
It does not render as you want when printing as pdf. (image missing).
Just base64 image, and change your tag as below:
    <img src="data:image/jpg;base64, base64-encode"/>
It will render image successfully.

Friday, July 3, 2015

qweb report - table with column contain row number

something, when render a table, you need show row number as first column, just do it as:
     <tr t-foreach="o.order_line" t-as="line">
           <td>
                   <span t-esc="line_index + 1" />
           </td>

Thursday, July 2, 2015

Hide report link

Typically, all reports will be appeared on Print drop-down list on all screens.
If you want to hide a specific report, just only inherit report and append this line:
     menu = "False"
Example:
    <report
            id="sale.report_sale_order"
            string="Quotation / Order"
            model="sale.order"
            report_type="qweb-pdf"
            file="sale.report_saleorder"
            name="sale.report_saleorder"
            menu="False"
   />