【发布时间】:2022-07-12 23:39:19
【问题描述】:
我在 res_config_settings 中添加了一个布尔属性。当布尔值为 False 时,我想删除自定义模型('my.device')中的所有记录。
我尝试了三种不同的方法:
- 在 res_confg_settings 中:
devices.unlink()```
2. Also in res_config_settings:
```
devices = self.env['my.device'].browse()
for d in devices:
d.unlink()
- 在
my.device模型中:
def unlink_all(self):
for rec in self:
rec.unlink()```
I then call `self.env['my.device'].unlink_all()` from `res_config_settings`
None of them work. Strangely, the first time I tried option 1, all but one records were deleted.
【问题讨论】: