diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-01-18 15:57:33 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-01-18 15:57:33 +0700 |
| commit | b33103dea998552d110d029d7f50ed08f58ce192 (patch) | |
| tree | 190b234940e662bcaee85e4edfaf87481ce1184d /indoteknik_api/controllers/api_v1 | |
| parent | 09c074be5de4fc10f6322303236b5919ff8234fb (diff) | |
add payment term validation in sales order and add website ads
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/content.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/content.py b/indoteknik_api/controllers/api_v1/content.py index 3d5b15e5..3d4e443a 100644 --- a/indoteknik_api/controllers/api_v1/content.py +++ b/indoteknik_api/controllers/api_v1/content.py @@ -6,6 +6,26 @@ from odoo.http import request class WebsiteContent(controller.Controller): prefix = '/api/v1/' + @http.route(prefix + 'product_ads', auth='public', methods=['GET', 'OPTIONS']) + def get_product_ads(self, **kw): + if not self.authenticate(): + return self.response(code=401, description='Unauthorized') + base_url = request.env['ir.config_parameter'].get_param('web.base.url') + query = [ + ('page', '=', 'product'), + ('status', '=', 'tayang') + ] + ads = request.env['website.ads'].search(query, order='sequence') + data = [] + for ad in ads: + data.append({ + 'id': ad.id, + 'name': ad.name, + 'image': base_url + 'api/image/website.ads/image/' + str(ad.id) if ad.image else '', + 'url': ad.url, + }) + return self.response(data) + @http.route(prefix + 'video_content', auth='public', methods=['GET', 'OPTIONS']) def get_video_content(self, **kw): if not self.authenticate(): |
