2017-03-11 1 views
1

내 Odoo 9 qweb 보고서를 다시 디자인하려고합니다. 그 상속 된 sale_order_report. qweb에서 호출 된 파이썬 함수를 만들었습니다. 이제 조건에 따라 파이썬 함수의 내용을 숨기고 싶습니다. 잠시 시간을내어 코드를 읽어보고 문제를 해결하는 방법을 알려주십시오.qweb 보고서에서 python 함수의 내용을 숨기거나 표시하는 방법은 조건에 따라 다릅니 까?

@api.multi 
def handle_detail(self, order_line): 
    dict_item = {} 
    for line in order_line: 
     for key in 
     quantity_extra = int(line.quantity_extra) 
     if quantity_extra not in dict_item.keys(): 
       dict_item[quantity_extra].append(line.lng) 
      else: 
       dict_item[quantity_extra] = [line.lng] 
result = [] 
total = 0.0 
for item in dict_item.keys(): 
    lst_ing = dict_item[item] 
    if len(lst_ing) > 1: 
     result.append(
      '(%s) x %s' % (' + '.join([str(lng) for lng in lst_ing]), 
          str(item))) 
     total += (sum(lst_ing) * item) 
    else: 
     result.append('%s x %s' % (str(lst_ing[0]), str(item))) 
     total += (lst_ing[0] * item) 
return result, total 

감사합니다.

답변

1

<t t-if="condition"> <!-- if the condition is true the contenant is shown --> 
     <....code that calls the method and show the value on the template /> 
    </t> 
같은 t-if 문에 의해 템플릿의 코드를 둘러싸고
관련 문제