I'm using openERP 7 and I'm having following process for processing new customer orders.
1) Open Sales Order
2) From the Sales Order, create Delivery Order
3) Back to the Sales Order and create Invoice
So far this process worked. Now I have new customer, who wants to have in his invoice(step 3), the Delivery Order no.(that was crated in step 2).
The problem is that in sale.order model(db table sale_order) and account.invoice model(db table account_invoice) there is no reference to the delivery order id(db field stock.picking.name). I can't find a option to refer to the stock.picking.name for my sales order from the invoice template, when I modify it with OpenOffice Writer. I can get the o.origin, which returns only the Sales Order No, but from there I can't refer to the Delivery Order no, because it's not in sale.order model. How can I add the Delivery Order number to the Invoice? Has someone done that?
Looking forward to your replays! Thanks!
It apperas that this is possible with standard. I could acheive it by switching to odoo v8 and changing the process from the described in the question to Generate Sales Order -> Generate Delivery Order -> Generate Invoice(but from the Delivery Order page, not from the sales order. This solves my problem and the invoice in v8 has the delivery order item in the default template. Looks like I will have to switch to V8.
Currently there is no sure way for you to determine which invoice is created from which delivery order. If you check the _prepare_invoice methods from odoo/addons/stock/stock.py you'll see that the picking.name is stored into the account.invoice's name. But this can be overriden by other modules. If you what to be very sure, then create a many2many relationship between stock.picking and account.invoice and you can play around with the _invoice_hook or _prepare_invoice methods from stock.picking to populate the relationship. It is called when you clicked the Create Invoice button.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 12/6/14, 11:33 AM|
|Seen: 2244 times|
|Last updated: 3/16/15, 8:10 AM|