Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivoustarvikkeet
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Tutoriaalit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

Odoo custom API module not working in hosted version

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
addonsapiv18
1 Vastaa
3307 Näkymät
Avatar
Shalitha Wanasinghe

I have created custom API module for odoo 18. My endpoint REST APIs are working fine in local version. But when I try to use it in the hosted version it gives 404 error.




0
Avatar
Hylkää
Avatar
Gracious Joseph
Paras vastaus

When your custom API module works in your local Odoo instance but gives a 404 error on the hosted version, it indicates that the hosted environment may not be configured to load your custom module or that there are deployment-specific issues. Here are steps to diagnose and resolve this issue:

1. Verify Module Installation on Hosted Version

Ensure your custom API module is installed and available on the hosted instance:

  • Check Installed Modules:
    • Go to Apps and ensure your module is listed as installed.
  • Install/Upgrade Your Module:
    • If not installed, install it via the Apps menu or run:
      bashCopy codepython3 odoo-bin -u <your_module_name> -c /etc/odoo/odoo.conf
      

2. Check the API Endpoint Configuration

  • Verify Endpoint Routing: Ensure your custom endpoints are defined correctly in your controllers file and are accessible in the hosted environment.
    Example:
    pythonCopy codefrom odoo import http
    
    class MyAPIController(http.Controller):
        @http.route('/my_api/endpoint', type='json', auth='public', methods=['POST'], csrf=False)
        def my_api_method(self, **kwargs):
            return {'message': 'API is working!'}
    
  • Test Endpoint in Hosted Version: Use a tool like curl or Postman to test the endpoint directly:
    bashCopy codecurl -X POST https://your-hosted-instance.com/my_api/endpoint -d '{}'
    

3. Verify Server Logs

  • Check Logs for Clues: Look for errors in the Odoo log file (/var/log/odoo/odoo.log or equivalent) when the 404 error occurs.
    Key things to look for:
    • Errors related to module loading.
    • Missing or unregistered routes.
    You can filter logs for your module:
    bashCopy codegrep '<your_module_name>' /var/log/odoo/odoo.log
    

4. Inspect Hosted Environment Configuration

  • Custom Module Deployment: Ensure the custom module is properly uploaded to the hosted instance. Verify:
    • The module is in the addons directory or an equivalent path.
    • The path to your custom module is listed in the addons_path of the Odoo configuration file.
    Example of a valid addons_path:
    iniCopy codeaddons_path = /usr/lib/python3/dist-packages/odoo/addons,/opt/odoo/custom_addons
    
  • Restart Odoo Server: If you recently added or updated the module, ensure the server is restarted:
    bashCopy codesudo service odoo restart
    

5. Verify Access Control and Authentication

  • Authentication Requirements: If your API requires authentication, ensure the credentials used in the hosted version are correct.
    • If using auth='public', ensure the endpoint doesn't have unnecessary restrictions.
    • For authenticated endpoints, verify the Authorization header is included in requests.
  • Cross-Origin Resource Sharing (CORS): If accessing the API from a different domain, ensure the hosted instance has proper CORS settings.

6. Firewall or Proxy Issues

  • Firewall Rules: Ensure that the hosted environment allows traffic on the required port (usually 8069 for Odoo).
  • Reverse Proxy Configuration: If using a reverse proxy (e.g., Nginx), ensure it forwards requests to your custom API correctly. Update the proxy configuration if necessary.
    Example Nginx configuration for API:
    nginxCopy codelocation /my_api/ {
        proxy_pass http://127.0.0.1:8069/my_api/;
    }
    

7. Debugging in Hosted Environment

  • Enable Debug Mode: Temporarily enable debug mode to inspect if your module routes are loaded:
    bashCopy codepython3 odoo-bin -c /etc/odoo/odoo.conf --dev=all
    
  • Test All Routes: Use Odoo's route debugging to check if your custom route is registered:
    • Access /web/environment/routes to see all loaded routes.

8. Redeploy the Module

If the issue persists, re-upload and reinstall your module:

  • Remove the existing module from the addons path.
  • Re-upload the module folder to the appropriate addons_path.
  • Restart the Odoo server and reinstall the module.

9. Host Provider Limitations

If your Odoo instance is on a hosted SaaS platform (e.g., Odoo Online), it may restrict custom module usage or require specific deployment steps. Contact your hosting provider to confirm:

  • If custom modules are supported.
  • The process to deploy custom modules in their environment.

Summary Checklist

  1. Ensure your module is installed and accessible in the hosted instance.
  2. Verify the API endpoint configuration in your module.
  3. Check server logs for routing or deployment errors.
  4. Confirm the module is in the addons_path.
  5. Restart the Odoo server after module changes.
  6. Ensure the hosted instance allows traffic to your API endpoint.
  7. Confirm with the hosting provider for any restrictions on custom modules.

0
Avatar
Hylkää
Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
Custom Code: REST API: Subscriptions Name Change
api sales_order Subscriptions v18
Avatar
Avatar
1
maalisk. 25
1573
Is it possible to sell on credit directly at the point of sale and leave the order pending payment?
v18
Avatar
Avatar
2
syysk. 25
675
Odoo isn't seeing an add-on that I downloaded and placed in the addons folder Ratkaistu
addons
Avatar
Avatar
Avatar
Avatar
Avatar
5
lokak. 25
2319
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
elok. 25
1248
ADD ON FINANCIAL MODULE/FISCALE ACCOUNTING FOR ODOO 18 COMMUNITY
addons
Avatar
Avatar
Avatar
2
elok. 25
1662
Yhteisö
  • Tutoriaalit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now