odoo Prefetch

2022-04-20 17:48:43 浏览数 (1)

代码语言:javascript复制
def name_get(self):
    # Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
    self.browse(self.ids).read(['name', 'default_code'])
    return [(template.id, '%s%s' % (template.default_code and '[%s] ' % template.default_code or '', template.name))
            for template in self]

0 人点赞