odoo 行信息展示

  • 2021-11-30
  • Admin

当行里出现行的信息时,tree视图无法展示。
即可用下面数据格式来

line_info = fields.Html(u'行信息', compute='compute_get_line_info')

@api.multi
def compute_get_line_info(self):
    for order in self:
        html_str = ""
        index =0for line in order.order_line:if index >2:
                html_str +=''%('..........')break
            html_str +='
%s
%s%s%s' % (line.product_id.display_name, line.product_qty) index += 1 html_str += '
'
else: html_str = '' order.line_info = html_str
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

当大于2行时,其余的用…代替

原文:https://blog.csdn.net/weixin_42464956/article/details/121630720

联系站长

QQ:769220720