Skip to Content
Menu
This question has been flagged
2 Replies
3495 Views

I need to automate the request to the API of a warehouse company and update the stock of my inventory module with the response. I'm new to Odoo and as far as I researched the easiest way to implement anything in Odoo is using some existing module, but I don't know exactly what the appropriate module for this case is (if there is any). Also, I watched some tutorials where people programmed entire API modules and I think that would be more than I need. I would appreciate any help!


To be sure you fully understand the explanation, this would be an example of what I want to achieve:

1. The stock of product X in my inventory is 5.

2. The automated request to Warehouse company's API triggers.

3. The response indicates that product X inventory is actually 3.

4. My inventory gets updated to show product X stock is 3.

Avatar
Discard
Best Answer

I recently had a similar requirement and was able to solve it with these steps:

  • Create a new stock.quant​ model with the following data:
    • product_id​: Associated product.product
    • location_id​: Warehouse ID
    • inventory_quantity​: Stock at hand
  • After creating the new entry, it will not immediately be applied. You will need to call the action action_apply_inventory​ and pass the ID of the new stock.quant​ model.

Maybe someone has a better solution, but this is the only viable solution I have found so far. However, it should thoroughly be tested to see if it has any side implications in your use case.

Avatar
Discard

For what version of Odoo? I tried to do this on v17, but after I create a `stock.quant` entry and try to call the `action_apply_inventory` action on it, it says

"Record does not exist or has been deleted."

The record does exist, though. What I noticed is that after a couple of hours, it is automatically deleted.

Best Answer

I am interested in how you called the action with the API.  All of my attempts have not gotten anywhere.  I can update the quant with the appropriate numbers but can't get it to actual update the count in the system.

Any help is appreciated.

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 24
920
1
Feb 23
2161
2
Aug 22
2194
5
Apr 24
8507
3
Sep 17
4872