コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
7689 ビュー

I know create an entry like this :

model_obj= self.env['myapp.model']
model_obj.create('name': 'a name')

But how remove an entry ? Is it exist a method like that ?

model_obj.remove()


アバター
破棄
最善の回答
model_obj.unlink()

Review the documentation at:

https://www.odoo.com/documentation/11.0/reference/orm.html#reference-orm-model

アバター
破棄
最善の回答

There are basically three methods which we can override.

  1. Create
  2. Write
  3. Unlink
class Campus(models.Model):
    _name='campus'    
    @api.multi
    def unlink(self,values):
        campus_unlink = super(Campus,self).unlink()
        return campus_unlink

The above code snippet is for unlink or delete an entry.

You can find other methods from here: http://learnopenerp.blogspot.com/2017/11/how-to-override-odoo-functions.html


アバター
破棄
関連投稿 返信 ビュー 活動
2
5月 21
21318
0
9月 19
3389
0
6月 19
4804
1
6月 18
4568
0
3月 18
4188