콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

Hello,

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!

Regards,
Pavel

아바타
취소
작성자

Hi, Maybe in order to access the delivery order no, I have to add it to the account or sales order models...  Maybe I should add to the account.invoice object new column with type related or many2one (https://doc.odoo.com/trunk/server/03_module_dev_02/) Someting like: class account_invoice(osv.osv): .... _columns = { 'delvery_order_name': fields.related( 'delvery_order_name': fields.related('origin', 'name', type="many2one", relation="sales.order" string="DeliveryOrder", store=False) } Has someone tried doing that somehow to mapp account invoice object to the stock.picking object via the sales.order object? Is there smarter way to do that? Regards. Pavel

작성자

Morning everyone! I still have not found solution for that. I'm now checking the features & code of v8, so in case this is already implemeted there I would have to migrate to v8. Has someone achieved that in v7 or v8 somehow? I'm still not sure I have the proper solution in mind... Thanks! Regards, Pavel

작성자 베스트 답변

Hello,

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. 

Regards,
Pavel

아바타
취소
베스트 답변

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.

아바타
취소
작성자

Hi Ivan, which version is that? In my addons/stock/stock.py there is no prepare_invoice method. I'm looking in v8 at the moment. Regards, Pavel

I'm looking through v7 of the code. For v8 try the stock_account module. Create Invoice button eventually calls action_invoice_create method in addons/stock_account/stock.py. There are _get_invoice_vals and _create_invoice_from_picking that seems to be parallel of _prepare_invoice and _invoice_hook of old. But, I haven't really tested it myself.

관련 게시물 답글 화면 활동
6
4월 20
9730
1
3월 24
1715
3
12월 23
7350
1
8월 20
12127
9
8월 18
7925