I added a discount field to my purchase orders, I make my purchase invoices based on them, and I need discount passes from purchase orders to purchase invoices. I was looking for the method who reads the lines from purchase orders, and writes it on purchase invoices, but I don't find it. Anyone knows wich function make this operation? Thanks in advice.
Câu hỏi này đã bị gắn cờ
zbkik solves my problem. He said:
If your Default invoicing control method = Based on incoming shipments, you see _get_invoice_line_vals in stock_account/stock.py
if you are looking for discount on order lines.. take a look here:
https://www.odoo.com/apps/7.0/purchase_discount/
if youre looking for additional discount (on total of invoice) maybe google a bit over partners repositories ... you will find some interesting stuf...
That module is not working for 8.0, i'm doing a new module based on purchase_discount existing addon. It has this code, to do what I want, but it doesn,t work: class purchase_order(orm.Model): def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None): result = super(purchase_order, self)._prepare_inv_line(cr, uid, account_id, order_line, context) result['discount'] = order_line.discount or 0.0 return result class stock_picking(orm.Model): _inherit = 'stock.picking' def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id): if move_line.purchase_line_id: line = {'discount': move_line.purchase_line_id.discount} self.pool.get('account.invoice.line').write(cr, uid, [invoice_line_id], line) return super(stock_picking, self)._invoice_line_hook(cr, uid, move_line, invoice_line_id)
I have new objetcs on my addon inheriting purchase.order and stock.picking, with new functions to _prepare_inv_line from purchase.order and _invoice_line_hook from stock.picking, but them seems not to be called from the invoice process, because the code I have for these methods does nothing. I put a message with raise osv.except_osv into the code, to be sure the functions are called from the make invoice process, but it isn't showed. Because of this, I think odoo 8 uses another functions to the invoice process, but I can find them.
If your Default invoicing control method = Based on incoming shipments, you see _get_invoice_line_vals in stock_account/stock.py
Thanks zbik, it helps to break my mind on the next step ;)
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 1 23
|
10331 | ||
|
|
2
thg 7 19
|
4528 | ||
|
|
0
thg 5 16
|
5522 | ||
|
|
2
thg 4 16
|
7280 | ||
|
|
0
thg 3 15
|
5377 |
purchase/purchase.py - method: _prepare_inv_line(self, cr, uid, account_id, order_line, context=None)
Thanks zbik, it helps to break my mind on the next step ;)