Hello. This is a bit tricky to explain but should be easy to execute.
We sell mostly drop ship and some items from our warehouse. The items we have in stock were ordered from our manufacturer through oscom just like any other drop ship order. But the customer was our warehouse. Now we have those items in or warehouse and on on a stocklist we email out. When someone buys from that stock list we need to handle it in a special way...as follows.
We need to add a new process. to the order_editor contrib....
Just as normal... you go to Add order then..You go to add item.
There (At Add item) I need ..
An additional new button..."Add Item from STOCK"..
A drop down box appears and shows a list from table patagon_pedidos(a table we have already added to oscom db whose PK is called pedidonum)
That list is filtered to show only pieces in stock (this filter is based on a field value being greater than 1000)
You select the item to add and click the OK button... and
Automagically the following happens based on record selected...
1) The item is cloned from it's original order number and added to this order..which is know becuase field f40 in patag_pedidos table = order_products_id.
2) A note note is placed into the original order's item description saying "control number-'[pedidonum]' has been sold as part of order number '[new-order_id]' line item [new_orders_products_id]"
3) F40 fields in table patagonia_pedidos is updated with the new orders_product_id.
4) F39 field is marked as Sold from old STOCK order [orderid] item number [orders-productID] to new Item number [orders-productsID] on new order [orderID] to [clientshort]