콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4993 화면

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.

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
5월 15
6352
1
12월 22
44865
1
9월 18
4481
0
3월 15
11596
1
3월 15
9872