Hi...I need to call the method write of account invoice from a button. I have a form with information and i want to create a draft invoice when the button is clicked passing the values for the invoice for parameter. Thanks
Câu hỏi này đã bị gắn cờ
1
Trả lời
20930
Lượt xem
The method to create a new invoice is not write but create. Write is used to change values in existing record.
This is a basilar code to create an invoice
your_class_records = self.browse(cr, uid, ids)
for record in your_class_records:
invoice_id = self.pool.get('account.invoice').create(cr, uid,{
'name' : record.name,
'date_invoice' : record.date,
})
for line in record.line:
self.pool.get('account.invoice.line).create(cr, uid,{
'invoice_id' : invoice_id,
'name' : line.name,
'product_id' : line.product_id.id,
})
http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/methods.html
HI. When i try this i get an error cr is undefined. How do I solve this
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký| Bài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
|---|---|---|---|---|
|
|
1
thg 6 24
|
4249 | ||
|
|
1
thg 3 15
|
13762 | ||
|
|
0
thg 6 26
|
687 | ||
|
|
0
thg 6 26
|
42 | ||
|
change between 2 Invoice formats
Đã xử lý
|
|
1
thg 7 25
|
4038 |
Thanks. It worked!