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

Hello everyone. I am trying to copy the Confirmation Date of a SO to each line. I created the date field but I am not able to tell Odoo to fetch this date. I cant find any tutorials that address this problem. This is my last attempt code:

for record in self:

  record[("x_studio_fecha_de_entrega")] = sale.order.confirmation_date.date() 

This is the error:

ValueError: <class 'NameError'>: "name 'sale' is not defined" while evaluating
'for record in self:\n  record[("x_studio_fecha_de_entrega")] = sale.order.confirmation_date.date()'

Any help would be appreciated.

Best regards.

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

Assuming that self is a recordset of sale.order.line you could do it like this:

for record in self:
    record.x_studio_fecha_de_entrega = record.order_id.confirmation_date

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 24
1696
0
thg 5 20
2021
1
thg 7 25
1439
2
thg 3 25
1672
0
thg 2 25
1314