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

十年热恋 提交于 2019-12-11 20:38:09

问题


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



来源:https://stackoverflow.com/questions/35317338/how-to-print-right-to-left-report-on-odoo-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!