[NEW] partner_gogocarto_export_api: create add-on
Transfers add-on partner_gogocarto_export_api from OCA partner-contact repo
This commit is contained in:
committed by
Stéphan Sainléger
parent
9325c02b53
commit
de273ec571
1
partner_gogocarto_export_api/controllers/__init__.py
Normal file
1
partner_gogocarto_export_api/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import main
|
29
partner_gogocarto_export_api/controllers/main.py
Normal file
29
partner_gogocarto_export_api/controllers/main.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import Response, request
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PartnerGogocartojs(http.Controller):
|
||||
|
||||
@http.route(
|
||||
'/web/<company_id>/get_http_gogocarto_elements',
|
||||
methods=['GET'],
|
||||
type='http',
|
||||
csrf=False,
|
||||
auth="public",
|
||||
website=True)
|
||||
def get_gogocarto_elements_http(self, company_id):
|
||||
data = self._jsonify_get_partner(company_id)
|
||||
return Response(json.dumps(data))
|
||||
|
||||
def _jsonify_get_partner(self, company_id):
|
||||
PartnerSudo = request.env['res.partner'].sudo()
|
||||
parser = PartnerSudo._get_gogocarto_parser(company_id)
|
||||
partners = PartnerSudo.with_context(force_company=company_id).search(
|
||||
PartnerSudo._get_gogocarto_domain(company_id)
|
||||
)
|
||||
return partners.jsonify(parser)
|
Reference in New Issue
Block a user