Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5659 Lượt xem

I understand that Bills for Purchase Orders can be created one at a time either from the Purchase Order itself, or by creating a Vendor Bill and selecting the Purchase Order.

In both cases, the Bill is created based on all received lines with prices matching that on the PO.

I have over 600 Purchase Orders that need to have Bills created for them.  How can I get these generated without doing them one at a time?    

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Create a Server Action (attached to the Purchase Order model) that incorporates the following basic code:

invoice = env['account.invoice'].create({            
          'type': 'in_invoice',
'purchase_id': record.id,
          'partner_id': record.partner_id.id,
})
invoice.purchase_order_change()
You will end up with a DRAFT Vendor Bill in the same way as if you had clicked CREATE (to make a new Vendor Bill) and selected a Purchase Order (to have the received lines at the PO line cost added to that Bill).
Ảnh đại diện
Huỷ bỏ

Hi Ray, Im using odoo 13 community, could this code work on v13 and how to get invoice to open directly from PO ! thx

This question was related to creating Bills for many Purchase Orders at once. There would be no need to open a Bill in this situation. Can you ask a separate question? Purchase Orders already have a CREATE BILL which creates and opens the Bill directly from the PO so be sure to give details about what you are asking, pasting screenshots to help readers understand.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 21
4625
3
thg 12 24
13833
2
thg 12 22
1856
1
thg 8 19
5126
0
thg 11 23
1494