unable to fetch information from OdooRPC

I've encountered an issue while trying to fetch data from the database using jsonRpc through the Odoo API. The error message I received was "HTTP/1.1 GET /projects - 404 Not Found".

Below is the snippet of my code:

A Python script used for data manipulation:

class project:
    def GET(self):

        print("get")
        data=[]
        web.header('Access-Control-Allow-Origin',      '*')
        web.header('Access-Control-Allow-Credentials', 'true')
        web.header('Content-Type', 'application/json')

        auth = web.input()
        print(auth)
        odoo = odoorpc.ODOO('field.holisticbs.com',port=8069)
        odoo.login('field.holisticbs.com','[email protected]','admin')

        Project = odoo.execute('project.task','search_read',[[['company_id', '=', int(auth.company)],['user_id','=',int(auth.user)]]])
        return json.dumps(Project)

controller.js:

controller('projectCtrl',function ($scope,API,$localStorage,localStorageService) {
  console.log("Project ctrl");
  API.showLoad();

  var resource = "projects";
  API.getData(resource, localStorageService.get('user')).then(function(data) {
    console.log(data);
    $scope.projects = data;

  }).catch(function(data, status) {
    alert("error in request");
  }).finally(function() {
    console.log("finally finished projects");
    API.hideLoad();
  });

})

service.js:

function getDetails(resource,data) {
        console.log(resource);
        console.log(data);
        var request = $http({
            method: "get",
            url: backend+resource,
            params: {instance: data.inst, user:data.user, company:data.company}
        });
        return(request.then( handleSuccess, handleError ));
    }

project.html (view page displaying blank):

<ion-view view-title="Projects">
  <ion-content>
    <ion-list>
      <div class="card" ng-contoller="projectCtrl">
       <a class="button button-icon" href="#/app/newProject">
        <button class="button button-positive">Create Project</button> </a>
      <h2> project </h2>
        <ion-item ng-repeat="proj in projects" href="#/app/projects/{{proj.id}}">
          <h2 class="padding">{{proj.id}}. {{proj.name}}</h2>

              <div class="row" ng-if="proj.partner_id[1]">
                <span class="col col-25">Customer:</span>
                <span class="col">{{proj.partner_id[1]}}</span>
              </div>

              <div class="row" ng-if="quot.date_order">
                <span class="col col-25">Date:</span>
                <span class="col">{{proj.date_order}}</span>
              </div>

              <div class="row" ng-if="quot.state">
                <span class="col col-25">Status:</span>
                <span class="col">{{proj.state}}</span>
              </div>

        </ion-item> 
      </div>
    </ion-list>
  </ion-content>
</ion-view>

Answer №1

This little mistake is really bugging me - forgot to specify the URL for routing.

Here are the correct URLs for routing:

  • '/products' - maps to 'products'
  • '/projects' - maps to 'projects'
  • '/product/(.+)' - maps to 'product'

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to reset iframe style height in IE8 using JavaScript

I am encountering an issue with resetting the height of an iframe using JavaScript. Here is the code snippet I am working with: var urlpxExt = document.getElementById('urlPx'); urlpxExt.style.height = "200px"; While this approach works well in m ...

Issue with alert not being triggered in browser when using HTML and JavaScript function

Just starting out with HTML and Javascript! I'm working on a simple program where users can input a card number, and the browser should indicate whether it is valid (between 13-16 digits) or not. The website looks great, but I'm not getting an ...

Dynamic form in Yii2 developed by wbraganca that displays or hides fields depending on the value of a radio button

I am currently using the wbraganca dynamic form in a popup modal. I need to display and validate fields based on the selection of a radio button. To achieve this, I am calling a JavaScript function in the onchange event. <?= $form->field($model, "[{ ...

Error message: jQuery expression not being detected

Here is some html code that I have in my view: <div id="divLoginName" style="display: none"> <input type="hidden" id="hidLoginName" /> @Html.TextBox("txtEditLoginName", null, new { maxlength = "1000", tabindex = "0", Multiline ...

Ways to determine if the property of a document has been altered?

Currently, I am in the process of writing tests for an Express CRUD application. The specific route I am focused on is the account recovery route. This route accepts POST requests with an email included in the body. Essentially, the application will search ...

Is there a way to retrieve values from a different menu without the need to refresh the page?

Whenever a radio button is clicked on a form, a popup menu is displayed. The popup menu is implemented using the Bootstrap module. However, there is an issue where selecting an option from the popup menu causes the form to reset, resulting in the loss of ...

Uploading multiple files via AJAX without any files being uploaded

I have been attempting to upload multiple files with just one AJAX request. However, I am encountering some issues, including: UPDATE No files are being successfully uploaded to the server It appears that multiple AJAX requests are being triggered due t ...

Learn how to clear form values in react-bootstrap components

My objective upon clicking the register button is: Clear all input fields Hide any error tooltips Check out the CodeSandbox link I attempted to reset using event.target.reset();, but the tooltips persist on the screen. export default function App() { ...

What are some ways to enlarge the dx-treeview when a new item is added?

I created an application using AngularJS that involves performing CRUD operations on Categories and Phones. I need help expanding the dx-treeview to display newly added items. https://i.stack.imgur.com/GSaPp.png When I click on the Save button, it takes ...

Join the Observable in Angular2 Newsletter for the latest updates and tips

One of my functions stores the previous URL address. prevId () { let name, id, lat, lng; this.router.events .filter(event => event instanceof NavigationEnd) .subscribe(e => { console.log('prev:', this.previo ...

Store the output of the function in a variable

Here is a script that was provided to me: <div id="container1"> <script> var script = document.createElement("script"); script.type = "text/javascript"; script.text = 'document.write(xmlDoc.getElementsByTagName("INFO") ...

Ways to alter the div post user authentication

I'm in the process of developing a website with a single-page application setup. I'm utilizing Node.js for the backend and Angular for the frontend. The challenge I'm facing is displaying a specific div when a user is not logged in, and swit ...

Exploring the Integration of Material UI DatePicker with Firestore in ReactJS: Converting Firestore Timestamps to Date Format

The database is correctly recording the date, however, when displayed, the DatePicker does not recognize the date from the database as it is in timestamp format (seconds and nanoseconds). <DatePicker margin="normal" label="Data do pedido" ...

Can someone explain the distinction between 'return item' and 'return true' when it comes to JavaScript array methods?

Forgive me for any errors in my query, as I am not very experienced in asking questions. I have encountered the following two scenarios :- const comment = comments.find(function (comment) { if (comment.id === 823423) { return t ...

Ways to eliminate the identical element from an array

In my JavaScript code, I'm working with an array like this: ['html', 'css', 'perl', 'c', 'java', 'javascript'] I want to know how to remove the "perl" element from this array. The objectiv ...

Http Angular service lacks a provider

@Injectable() export class MyService { constructor(private http: Http, @Inject('name') @Optional() public name?: string) { } When setting up my appModule, I attempted to define a provider for MyService service. MyService, import ...

Using jQuery to add the name of a file to FormData and fetching it in a PHP script

I've been working on a JS code snippet dedicated to uploading images based on their file paths: var data = new FormData(); data.append('fileName', fileName); data.append('file', file); $.ajax({ url : dbPath + "upload-file.php" ...

What is the correct way to bind by reference when utilizing a function that returns an object?

I currently have an object in my Component: this.user = Authentication.user; It's working perfectly fine as it copies the reference. So, if Authentication.user changes, this.user in my Component also changes accordingly. However, I am curious to kn ...

Parent scope receives directive updates with a slight delay

I recently made a transition of my simple paging feature from the controller to a directive, but encountered a peculiar issue. Whenever I update the parent scope from within the directive, the changes only reflect on the next alteration. For instance, if t ...

Top method for patiently awaiting the completion of the .forEach() function

There are times when I find myself waiting for a .forEach() method to complete, especially in functions involving loaders. My current approach involves using the following code: $q.when(array.forEach(function(item){ //perform iteration })).then(func ...