Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5011 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 12 24
1441
2
thg 2 24
2959
4
thg 11 23
3397
1
thg 8 22
3706
2
thg 7 22
9182