This question has been flagged
2 Replies
9470 Views

Hi,

When I confirm a sales order i can see that my sale.order.line's are moved to stock.move but in code I am not able to see where exactly it is happening. Can anyone please guide or help!!

Avatar
Discard
Best Answer

Hi Shiv Modi,

If you want reference of SO line which is associated with stock move than,

You have to follow this.

1) stock move having reference of procurement when stock move created related procurement record is also created which having the sale order line references.

So, you can not get the sale order line reference directly from stock move.

2) You have do like this,

consider move is browse record of your stock.move

If you have only move_ids than follow this :

stock_move_obj self.pool.get('stock.move')
sale_lines = [ move.procurement_id.sale_line_id for move in stock_move_obj.browse(cr, uid, move_ids) if move.procurement_id and move.procurement_id.sale_line_id] 

print "Browse record of Associated Sale Order LIne",sale_lines

#If you want Sale order line ids only. than

sale_line_ids = [ move.procurement_id.sale_line_id.id for move in stock_move_obj.browse(cr, uid, move_ids) if move.procurement_id and move.procurement_id.sale_line_id]

print " Sale Line IDs:::::",sale_line_ids

Hope this will helps.

Rgds,

Anil.


Avatar
Discard
Author

Thanks Anil...This question was for just a reference. The problem is, I have products where I don't even select a product and only description is there. So when i confirm sales order -> Confirm Availablility -> Transfer and the create invoice my sequence is distorted because product related data is coming through stock move but only description related data is coming from sale.order.line. Want to know how Create Invoice is calling two functions separately....one for products selected and other only for description items.....Thanks in advance

Author

Thanks Anil, your answer was helpful :)

Best Answer

Sale order -> create -> Procuremet ->. create -> Stock move

See: module stock, file procurement.py, method _run_move_create

Avatar
Discard