跳至内容
菜单
此问题已终结
2 回复
8228 查看

I am using odoo 12 community version

beginner. please help

形象
丢弃
最佳答案

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

形象
丢弃

thx you saved a day!

编写者 最佳答案

Thanks, but what about the date field?

形象
丢弃