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

Can some one explane me relation between sale.order.line and invoice.line. 

For example i added field check_qty = fealds.float("Qty") to sale.order.line

when i confirm SO i get Invoice that is related to SO. In that invoice are invoice.lines that are created from SO sale.order.lines. 

and i have field check = fields.boolean("check") in invoice.line. 

so my goal is to check related sale.order.line of invoice.line if "check_qty" > 0 then i make field check = True

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

Hello,

into sale.order.line has field name "invoice_lines" and into account.invoice.line has field "sale_line_ids".

this both fields type is many2many and have common relational table.

so using this two fields you can achieve your goal.

Thank you.

Ảnh đại diện
Huỷ bỏ
Tác giả

for line in invoice.invoice_line_ids:

if line.sale_line_ids:

if line.sale_line_ids.qty_avl_stock >= line.sale_line_ids.product_uom_qty:

if i do something like this, i can get "expecting singleton error" because it's many2many fields and there can be more then 1 record

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 25
990
0
thg 1 23
1534
2
thg 10 21
3086
2
thg 1 25
4425
0
thg 2 20
3252