I have problem with multi companies flow when confirm order Odoo 15 - odoo

I have a multi companies flow where Purchase Order from Company A will create Sale Order for Company B, I am trying to automatically confirm that Sale Order. Each Company has different flow when confirm Sale Order.
I am running the code with OdooBot because I need access to both Companies, but when confirm Sale Order for company B, it always trigger the flow of confirming order of company A, I dont know why.
If I choose both companies on the top right multi-company widget and then confirm the SO, the same problem happens.
If I only choose company B on the top right multi-company widget and then confirm the SO, it will work fine.
How am I gonna simulate this behavior by code? I tried with_company and with_context(allowed_company_ids), nothing worked
so_res.with_company(so_res.company_id).action_confirm()
It still triggers the flow of company A

Related

How to control states of sales orders in Odoo SA

I want to create a new state for a sales order that is beyond a quotation, but not quite confirmed. I'd also like to have orders that come in from the web portal to go into that state. What I'm trying to accomplish is to have an intermediary step where an inside sales manager can check that all requirements for the customer are taken care of before the order is confirmed and goes to fulfillment. This allows us to have a rep reach out to the customer in the case we need something additional from them.
I'm using Odoo 9 SA so I don't have the ability to build out a module.. so my question really is how can I accomplish this using server actions and the other internal tools? Any suggestions?

Can we override inventory check in BigCommerce

I want customers to order the product even if it is out of stock, however I want to keep the Inventory tracking option ON as well. So for example if I have a product with 100 items in the stock, if someone orders it I need to see how much left in the inventory and on the other hand of product is out of stock, customer should still be able to order it. Is there a way we can achieve this while overriding any API?
We got it to work by using ajax and javascript. Basically we replaced the text that is generated by bigcommerce for inventory with a little script that checks inventory through our ERP. We then turned off inventory tracking for all products and backorders are now available. I wish I could post a few lines of code to help you, but the script is specific to our database. You can still use all the other features of the API (order import etc.), but you are not using the api for inventory tracking.
Hopefully this gets the wheels turning.

Prestashop backorders

By default my store does not allow for backorders. I want some products to be allowed. So I go at the product and change it to allow it. So far so good.
My issue is when someone backorder that product. I want the system to automatically change its status to "ON BACKORDER" (which it's not doing) and, when I have the product on stock it change it again to payment accepted.
Is that a way of doing so? If so, how?
Thanks a lot guys
EDIT
What I would like to do is this:
I want to star selling a product which will only be available 10 days from now, for instnace.
So I add it with zero stock and choose "Allow backorder"
When a client order this product and pay for it, I want their order's status to be set to BACKORDER and for then to receive an e-mail informing this
So do you want that a customer has no ability to buy products that are on backorder? Because now it works how it should be: if product is out of stock=you can't buy it, if it's on backorder=you can buy it with so called negative store level. What you're trying to achieve is probably called Waiting list and is not a default Prestashop behaviour. There are few paid extension on addons.prestashop.com for this

Selenium tests, how would you do?

I'm thinking about the best way to do the following kind of tests with selenium and I wanted asking how you would do.
I have 2 different clients in the system that I have to check, the first one offers something to sell and the second one has to do an offer. The offer can be accepted or declined.
Example.
Person 1: I want to sell a car so I put my car with all its details onto the system.
Person 2: I want to buy a car so I search for a car, I see the car of person 1 so I do an offer. On my dashboard is showed that I did an offer.
Person 1: I access to my dashboard and I notice that there is an offer, I see the offer, I decline because I don't like it.
Person 2: I access to my dashbord and I notice that the offer has been declined, I make another offer.
Person 1: I access my dashbord and I notice the new offer, I like it, I accept.
How would you organize the tests with selenium??
I would consider your example as 5 separate user stories. You can create a separate automated test for each of these stories. For this purpose, you would have to define preconditions for the test and the desired outcome.
For example, for the 1st story there are no preconditions, other than the trivial ones, like a user with such and such username exists and has privileges to sell cars. You will have to script the process of putting car details into your system using Selenium. The desired outcome is the car is in the system (can be searched for or shows up in the full list of cars for sale) and its attributes match what was entered.
For the 2nd story a precondition is that there is a car for sale. You will have to ensure this either by submitting car for sale via the process you developed for the 1st story or by entering it bypassing UI, for example via business services layer or inserting directly into the database. The desired outcome is that the dashboard for user 2 shows the offer.
And so on.

paypal subscribe monthly option and buy now full price in one button call

I have looked through the docs of paypal's api and cant find and option that will allow me to have a user click on a buy now button on my site and when they land on the paypal payment screen be presented with two ways to pay.
Either a monthly cost of $25. subscription model.
One time yearly payment of $300. non-subscription model.
Has anyone done this or could point me in the right direction. Ideally i want the select options to live on the paypal side not my website's side.
THanks
After looking into this some more here is what i found:
2 options:
- Create two buttons with each values. 1 reoccurring and 1 flat rate.
- Create a button with drop-down code that has two reoccurring payment options. You need to have a drop-down on your site for them to select and pass that option to PayPal. The only downside to this is that they both seem to have to be reoccurring and cant be different types.