This question has been flagged
2 Replies
2368 Views

In our sales system we need to perform different sales on behalf of different companies (actually, there are two). For this we created two companies, two warehouses (because "company" field in quotation form is read-only) and assigned these warehouses to different companies. Then, when we create quotation, we can choose different warehouses for it. According to selected warehouse, quotation's company_id (quotation->edit->other info->company) should change automatically (on the form it is read-only). But it doesn't happen!

What are we doing wrong?


Exact steps to reproduce:

1) Create new DB in odoo 8.

2) Install "sales" and "stock" apps.

3) Enable multiple companies (Settings->General settings->Manage multiple companies).

4) Create second company ("Your Company" already exists): Settings->companies.

5) Enable "multiple locations" (Settings->Warehouse->Manage multiple locations and warehouse).

6) Create second warehouse (Warehouse->warehouses).

7) Edit both warehouses and set "location" to different companies.

8) Do the same for "owner" field in Warehouse->locations.

9) Create sample customer and product.

10) Create a quotation with 1 product and try to change it's "warehouse".


Expected results:

When editing quotation and changing "warehouse", "company" field should also change automatically.


Actual results:

It does not.


Technical details:

We looked into underlying postgresql db. In "stock_warehouse" table there is "company_id" field - but it cannot be changed from UI and is always set to 1. If we manually change it - company change on warehouse change (on the "quotation" form) begins to actually happen! BUT - the results are not preserved in DB (quotation is still assigned to company #1).

Avatar
Discard
Author Best Answer

Thank you, Mark, it really worked when we added both companies to the user's profile (we also needed to check "multiple companies" in the user's properties).


But it still seems strange - from the user's point of view: on "quotation" form when one changes warehouse, the order's company ineractively changes too; but after save this change does not preserve!? Shouldn't it be considered as a bug?

Avatar
Discard
Best Answer

The quotation is assigned to the company of your user. You would have to add both companies to the user's allowed companies and then use the switch drop down on the top right to change the user's current company. The warehouse should then follow the user's company. It is not an ideal solution but many, many functions internally check user.company_id and pass that on to subsequent calls.

Avatar
Discard