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

I have a function which selects a query from database and returns a result, I want to use this function in my openoffice report, please help on how to call that function in the report.

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

You should add methods you want to use in the report in the python file inside report folder of your module. For example:

class picking(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        self.localcontext.update({
            'time': time,
            'your_method_name_from_rml':self._your_method,
        })   

    def _your_method(self,value):
        result = []
        object = self.pool.get('object.name')
        # DB query
        return result

In self.localcontext.update, you have to add the new methods added, so that they are "visible" from the RML file, together with the method they are related to.

You should call your new method from the RML file using the following code:

[[ your_method_name_from_rml(o.value) ]]

Hope you find this useful

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 15
6172
1
thg 12 22
44573
1
thg 9 18
4338
0
thg 3 15
11430
1
thg 3 15
9675