Requirement--
I have created a custom Purchase Order module for my Magento Store, in which a same product may be supplied from many suppliers. You will be fully cleared from below
example-
(1) A product P1 has been supplied to my store from three supplier say S1, S2 and S3 with quantity 5,10,15 respectively. Now I want to show SUM of all quantities i.e (30=5+10+15) to catalog inventory Stock. till Now there is no problem in doing this.
(2) Now When same product P1 is added to cart(Either frontend or backend) with qty 5 or less the there is no problem, order process will be Normal(as default). But if qty of same product P1 is added or updated greater than 5 (let's say 8) in quote then two rows(one row with qty 5 and second row with qty 3) should be created in sales_quote_item table corresponding to supplier S1 and S2, but in cart (i.e. visisble to user On frontend and Backend as well) there should be only one row having qty 8. Same as if product P1 is added or updated with qty lets say 20 then there should be three rows corresponding to each supplier having qty 5, 10 and 5 but user should see only one row having qty 20.
(3) If user place order of this product P1 with qty 20 then three rows should be there in sales_order_item table with their qty.
(4) In invoice that will be printed out also should have single row for that product P1, so customer can see only one row of that product, he doesnt need to know about suppliers.
(5) In credit memo there should be three rows so admin can decide himself, product of which supplier should be returned .
What I am trying Now--
I am following "fschmengler" approach. I am trying to modify quote items while they are being converted to Order. Now I am stuck at How can I modify price and totals according to changed qty in sales table and How can I add same product multi-times in sales table and then recalculate order totals. I am using event sales_convert_quote_item_to_order_item