OCA / connector-magento

Connect Odoo with Magento
http://odoo-magento-connector.com/
GNU Affero General Public License v3.0
105 stars 206 forks source link

Update Product Stock with Multiple Warehouse #251

Open panosdotk opened 7 years ago

panosdotk commented 7 years ago

I have a configuration in Odoo 8 with multiple warehouses, for example (WH1, WH2, WH3). I set the connector to synchronize with WH1 and the Stock Field to "Quantity On Hand". So if the quantities are WH1=10, WH2=5, WH3=5 I expect to synchronize the sum of all warehouses to magento (quantity=20). The connector synchronize only the changes to WH1. I try to change thw Stock Field to Forecast Quantity, Available to promise or leave it empty but nothing change.

jaredkipe commented 6 years ago

This is possible via a small override. I first added a fields.Char on the Magento Backend named 'location_list' which I put in the stock location ids comma separtated (WH1/Stock,WH2/Stock,WH3/Stock) which would be something like 5,15,25. Then override magento.product.procuct._recompute_magento_qty_backend to explode it/map it then pass the ids in to context as location in the same way the base implementation does. location = map(lambda i: int(i.trim()), backend.location_list.split(','))