跳至内容
菜单
此问题已终结
1 回复
5026 查看

I am using module "Base report xlsx" and xlsxwriter to write a report xlsx. But i have a problem about translate data. I alr use _() method and translate it in my language (vi.po -vietnamese) like: 

title_line_format = workbook.add_format({'bold': True, 'font_size': 20, 'align': 'center'})

data = _("Procurement List Report")

sheet.merge_range('A1:N3', data, title_line_format)

But when i export, my file still be written by english . Am i wrong? Can anyone explain why it didin't work?

Thanks and Regards,

Minh


形象
丢弃
最佳答案

It seems the lang context is lost when using report_xlsx

You can force the language on the report.py


e.g.

def generate_xlsx_report(self, workbook, data, products):
#force language
self = self.with_context(lang=self.env.user.lang)
形象
丢弃
相关帖文 回复 查看 活动
0
12月 24
1446
2
2月 24
2965
4
11月 23
3411
1
8月 22
3707
2
7月 22
9194