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

We need some data in the stock.picking module. The base document Sales Order can get the SO Number, but we also need some data coming from stock.picking.


I saw this question but no answer yet. https://www.odoo.com/forum/invoicing-5/accessing-stock-picking-from-invoice-184557


Ảnh đại diện
Huỷ bỏ

Do you want data from invoice on stock.picking or do you want data in sale order from stock.picking? Please clarify your question.

Tác giả

Oh sorry for confusion. From invoice we need some data coming in stock.picking.

Câu trả lời hay nhất

Hi,

Already we have a link between sale.order.lines to account.invoice.lines. We can create a Many2one computed field on invoice. Then we get all related sale orders.

sale_order_id = fields.Many2one('sale.order', compute='_compute_sale_order', store=True)
@api.depends('invoice_line_ids.sale_line_ids.order_id')
def _compute_sale_order(self):
    for rec in self:
        rec.sale_order_id = rec.mapped('invoice_line_ids.sale_line_ids.order_id')

Inside the sale.order model we have picking_ids. So we get those pickings by sale_order_id.picking_ids.

Regards

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 21
6711
2
thg 1 16
6464
1
thg 10 22
2723
1
thg 2 22
2927
1
thg 8 24
11794