blob: 19fdcb9c5a80ab1b05748677aca86a155488b97b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
from odoo import models
class Manufactures(models.Model):
_inherit = 'x_manufactures'
def api_single_response(self, manufacture, with_detail=False):
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
data = {
'id': manufacture.id,
'logo': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(manufacture.id) if manufacture.x_logo_manufacture else '',
'name': manufacture.x_name
}
if with_detail:
data_with_detail = {
'description': manufacture.x_short_desc,
'banners': [
base_url + 'api/image/x_banner.banner/x_banner_image/' + str(x.id)
for x in manufacture.x_manufactures_banners
if x.x_status_banner == 'tayang' and x.x_banner_image
]
}
data.update(data_with_detail)
return data
|