I have some real big problem, and don't know anymore what to do.
The method _product_reserve and get_product_available are not working the way i understood.
AS you can see, the customer booked about 30.000 products into "Wareneingang"(Stock Picking IN) and then could took over "check availability " from "Lager"(stock / stock_lot_id) to "Kunden"(Customer).
"Check Available" seems always took from "Lager" instead of "Wareneingang".
"Wareneingang" is for Stock Picking in warehouse and is under the lot Stock ID.
"Lager" is Lot Stock ID
An Example for one Product:
bestway_kw25=# select product_id, sum(product_qty), location_Id, location_dest_id from stock_move where product_id = 2131 group by location_id,location_dest_id, product_id;
product_id | sum | location_id | location_dest_id
------------+-----------+-------------+------------------
2131 | 1200.000 | 8 | 12 Lieferanten -> Lager
2131 | 5253.000 | 146 | 9 Wareneingang -> Kunden
2131 | 923.000 | 5 | 113 Bestandsaufnahme -> 204440
2131 | 1200.000 | 12 | 113 Lager -> 204440
2131 | 30768.000 | 8 | 146 Lieferanten -> Wareneingang
2131 | 1889.000 | 113 | 9 204440 -> Kunden
2131 | 17932.000 | 12 | 9 Lager -> Kunden
In das System gekommen:
2131 | 1200.000 | 8 | 12 Lieferanten -> Lager
2131 | 923.000 | 5 | 113 Bestandsaufnahme -> 204440
2131 | 30768.000 | 8 | 146 Lieferanten -> Wareneingang
Incoming => 32891
Aus dem System heraus:
2131 | 5253.000 | 146 | 9 Wareneingang -> Kunden
2131 | 1889.000 | 113 | 9 204440 -> Kunden
2131 | 17932.000 | 12 | 9 Lager -> Kunden
Outgoing => 25074
Ausgerechnet:
Stock => 7817
Buchungen für das Lager "Wareneingang":
-> Wareneingang
2131 | 30768.000 | 8 | 146 Lieferanten -> Wareneingang
<- Wareneingang
2131 | 5253.000 | 146 | 9 Wareneingang -> Kunden
Stock => 25515
Buchungen auf "Lager":
-> Lager
2131 | 1200.000 | 8 | 12 Lieferanten -> Lager
<- Lager
2131 | 1200.000 | 12 | 113 Lager -> 204440
2131 | 17932.000 | 12 | 9 Lager -> Kunden
=> 19132
Stock => -17932
Buchungen auf Lager "204440":
-> 204440
2131 | 923.000 | 5 | 113 Bestandsaufnahme -> 204440
2131 | 1200.000 | 12 | 113 Lager -> 204440
=> 2123
<- 204440
2131 | 1889.000 | 113 | 9 204440 -> Kunden
Stock => 234
Wareneingang: 25515
Lager: -17932
204440: 234
Stock => 7349