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

I am using odoo 12 community version

beginner. please help

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

Hi,

If you are looking to clear data entered in the one2many field and date field, you can try the below code,


@api.multi
def action_clear(self):
for rec in self:
rec.write({'order_line': [(5, 0, 0)],
'validity_date': ''})


Here in the above code, order_line is the One2many field and validity_date is the date field.

Thanks

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

thx you saved a day!

Tác giả Câu trả lời hay nhất

Thanks, but what about the date field?

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