Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

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

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

Odoo custom API module not working in hosted version

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
addonsapiv18
1 Відповісти
3327 Переглядів
Аватар
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
Аватар
Відмінити
Аватар
Gracious Joseph
Найкраща відповідь

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
Аватар
Відмінити
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Реєстрація
Related Posts Відповіді Переглядів Дія
Custom Code: REST API: Subscriptions Name Change
api sales_order Subscriptions v18
Аватар
Аватар
1
бер. 25
1580
Is it possible to sell on credit directly at the point of sale and leave the order pending payment?
v18
Аватар
Аватар
2
вер. 25
681
Odoo isn't seeing an add-on that I downloaded and placed in the addons folder Вирішено
addons
Аватар
Аватар
Аватар
Аватар
Аватар
5
жовт. 25
2343
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Аватар
Аватар
1
серп. 25
1284
ADD ON FINANCIAL MODULE/FISCALE ACCOUNTING FOR ODOO 18 COMMUNITY
addons
Аватар
Аватар
Аватар
2
серп. 25
1705
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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 - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція Odoo - це одночасно дуже проста у використанні та повністю інтегрована.

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