我试图重新设计我的奥多9 qweb报告。继承了销售订单报告。我创建了一些在qweb上被调用的python函数。现在我想隐藏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
谢谢你的时间。在
用这样的t-if语句将模板中的代码括起来
相关问题 更多 >
编程相关推荐