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

Hi friends,

I've encountered a problem in Odoo 16.

I need to have a method for the direct Export .xlsx file in Python and everything works great. The only problem is that Odoo originally (maybe as a bug) did not produce XML_ID for all records and I need to export this field.

Odoo will check it when the user wants to export files using the routine 'Export Wizard' and if the record does not have XML_ID, it assigns a new XML_ID to it and then produces the file.

But I could not do that in my Python code.


Clue: The function '__ensure_xml_id' in the following file of Odoo does the work.

https://github.com/odoo/odoo/blob/5d00b4146aa5cc1942d66e60dc92d321f79bf891/odoo/models.py#L923


How can I use this method in my Python file?

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

> But I could not do that in my Python code.

what is the reason ? are you getting any error ? 

> How can I use this method in my Python file? 
try python feature 'super' to inherit that method in your python file

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 22
1991
1
thg 5 25
2205
1
thg 4 25
3249
1
thg 4 25
4076
1
thg 4 25
1553