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

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


아바타
취소

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

작성자

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

베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
2
3월 21
6812
2
1월 16
6572
1
10월 22
2829
1
2월 22
3029
1
8월 24
11929