How to print right-to-left report on odoo 8

2019-09-09 12:58发布

问题:

I created a report in odoo 8 using RML, everything is good. but when i print the report, caracteres are printed from left to right. I tried with drawRightString but nothing does appears on the PDF.
I used openerp-rtl module but I noticed no changes.
What can i do to print it in RTL mode.

回答1:

Generally people working on Right to left text on Arbic Language.

so in this case you just install the below python-bidi package :

https://pypi.python.org/pypi/python-bidi/

python-bidi package is helpful to set the Pure python implementation of the BiDi layout algorithm.

And also add the bidi directory in your OpenERP report dir and use the get_display(string) method for making your sting convert into the arbic formate and also use with the arabic_reshaper class

You can do some thing like

import arabic_reshaper
from bidi.algorithm import get_display

def get_arabic_string(string):
    reshaped_text = arabic_reshaper.reshape(string)
    bidi_text = get_display(reshaped_text)
    return bidi_text

Just need to use the get_arbic_string function in your rml file and set it on rml and pass the sting as arbic formate.

just check another source :

pyfribidi for windows or any other bidi algorithm