from odoo import models class Manufactures(models.Model): _inherit = 'x_manufactures' def api_single_response(self, manufacture, with_detail=False): data = { 'id': manufacture.id, 'logo': self.env['ir.attachment'].api_image('x_manufactures', 'x_logo_manufacture', manufacture.id), 'name': manufacture.x_name } if with_detail: data_with_detail = { 'description': manufacture.x_short_desc, 'banners': [ self.env['ir.attachment'].api_image('x_banner.banner', 'x_banner_image', x.id) for x in manufacture.x_manufactures_banners if x.x_status_banner == 'tayang' ] } data.update(data_with_detail) return data