Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
217 Tampilan

We have three categories of products. They are stored in three warehouses. Products in Product Category 1 come from Vendor A and are stored in Warehouse 1, and products in Product Category 2 come from Vendor B and are stored in Warehouse 2.

It looks something like this:

Warehouse 1 - Product Category 1 - Vendor A

Warehouse 2 - Product Category 2 - Vendor B

Warehouse 3 - Product Category 3 - Vendors A & B

What we would like to avoid (and what has already occurred a few times), is the accidental purchase of a mixture of Product Categories 1 & 3 or 2 & 3 on the same purchase order, as they need to be delivered to two different locations.

To that end, I set up an automation rule as below:

The idea is that if there are products that are in Category 3 and products NOT in Category 3 in the same PO, it will throw an exception. However, it is not catching my test PO with an item from both Category 1 and Category 3.

I tried the same thing with a single product and it did work, and each individual rule is catching all applicable POs, so it seems to me like it's a bug.

Am I doing something wrong, or is there a better way to accomplish this?

Avatar
Buang

I think you would need to write some Python code to check all the PO lines. The field product_id on the Purchase Order is from the first PO line.

Penulis

That doesn't explain why it would work with "Product," though. If it's only seeing the first order line I would expect it to fail in the same way.

This works exactly as expected, only triggering if Product 1 and any other product are added to a PO:


I've tried changing the order, various product combinations and so far it works flawlessly, so it seems to be looking at all order lines for this field but not the product category field.

As I am not currently fluent in Python, I guess the workaround is to create a rule for each product, but that obviously doesn't scale well.

If you have Odoo Studio installed or can do customization, it should be simple to add a Product Category to the PO and then add a domain so that only products from that Product Category can be selected.

Jawaban Terbai

Why don't you use routes from the inventory module? 

There you can set a routes directing all products from a certain category to a specific warehouse or even stock location.


or maybe I don't understand the question correctly?

Avatar
Buang