This question has been flagged

Hi, Thanks for taking the time to read this post. I am new to Odoo and i am trying to build a website using the Enterprise website builder that i have installed. (https://www.odoo.com/fr_FR/app/website) 


I have deployed the sites on linux server with the following details: 

-Community Version 14.0

-Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64) 

-Python 3.7

-Php 7.2


I have a form on the website which will submit the form details to both an external API as well as a function in the builders' JS script that will handle the form and insert these data into a table in postgresSQL. The form action works fine and is able to reach both of my functions in JS.  (tested with alerts and its working.)


below are my codes for the function for insertIntoDB:

function insertIntoDB(form){

  //some functions to handle form values

  var handleInsertURL = "IP ADDRESS:8069/backEndUrl/insertIntoDb";

  form.action = handleInsertURL;

}


Using the same method, i am able to submit the form to the external API. However, it is not working on the "handleInsertURL" route. 


i proceed to test the routes of the controller itself. Below is the controller in custom.py that i have created (under /addons/website/controllers)


class TestingController(http.Controller):
@http.route('/backEndUrl/insertIntoDb',type="http", auth= "open", website=True)
  def index(self, **kw):
  return "Hello, world"


When i visited the url of IP ADDRESS/backEndUrl/insertIntoDb, i am expecting a blank page with words "Hello, world" but however, there is an error 404 stating page is not found. I am incline to think that the route is not reached.


I have put this set of codes in the main.py files in the controllers (under /addons/website/controllers), and the same results happened. 


I have the exact same environment and setup on windows in localhost, and everything is working fine. I have set the dbname to the DB that i am using, and i only have 1 DB in total.  So i am not sure if it is DB issue. 


Therefore:

1) is the way of handling insertion of data into DB the correct way? or is there a better way/ alternatives to approach this?


2) Is it something wrong with my codes that causes this or am i putting the files and function in the wrong directory? 


Thanks for any help in advance!



Avatar
Discard