تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3473 أدوات العرض

for clearity, I simplify codes as below:

class selection(models.Model):
    _name = 'my.selection'
    _rec_name = 'select'
    select = fields.Char(string='select', required=True)

​class Che(models.Model):
    _name = 'my.module'
    a_delete = fields.Integer(compute='_x_delete', store=False)#
    a_field = fields.Many2one('my.selection')


     @api.multi
    def _x_delete(self):
        self.ensure_one()
        recs = self.env['my.selection'].search([])
        for reci in recs:
            reci.unlink()​

each time, when I create a record of 'Che' and save it; a warning box would pop out as below:

Odoo Server 

Errormy.module(33,).a_delete
so why can't delete records of 'selection' or how shall I delete them in the function ' _x_delete'?


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 15
6152
1
أكتوبر 20
7703
1
مارس 15
8000
2
فبراير 25
5858
1
ديسمبر 24
1420