This question has been flagged
1 Reply
5298 Views

We are a service company; we have created products that are purchased automatically when they are sold to our customer. This creates a smart button on the sales order to the purchase order, and the other way around. 

However, I want to change the relationship and link an other purchase order to the sales order. Where can I change this relationship - I would like to fix this using studio


any insights much appreciated

Avatar
Discard

You can set vendor in the product, and set buy routes and Make to order, this will generate a purchase order whenever you make sales order for that product

Author Best Answer

Finally I managed to find the answer myself. The link between purchase order and sales order is not created on the level of the orders, but on the level of the order lines. Actually, in our case where we subcontract a service we sell, by setting the product (service) as being outsourced, whenever a SO is validated, this triggers the creation of a PO for the respective supplier. 

By using Studio, you can modify the PO order lines section in the form view. Add the field "Sale_order_id" to it, and make sure this field is not 'read only'. (this can be achieved by adding a domain to the 'read only' flag (like e.g. Id is not set). And for security reasons, make sure this field is only visible to certain user groups. 

Now you can edit / add / link the purchase order line to the sales order it should be linked to. In addition, you can even add the sales order line on the above mentioned list view, so that you can back link the purchase order line to the original sales order line. 

By going back to the sales order, you will find that the smart button in the top corner now links to the adapted PO.

Glad I could help myself (and others.)

Avatar
Discard

Hello Herbert,

I'm interest about this, because I have same problem too.

I try this tutorial but I can't find it. This field is existing in Po Order Lines or we need to add new relation field?

Btw, I'm using odoo v16

Thank you,

@Prih Herbert you have to add it: "Add the field "Sale_order_id" to it, and make sure this field is not 'read only'. (this can be achieved by adding a domain to the 'read only' flag (like e.g. Id is not set)."

i have tried adding this field you mention with the flag to prevent read only to the purchase order forms and it doesnt work, we are using version 17, is there anyway you can add screenshots or a step by step of which field should be added to what part of the form?