错误备份odoo

时间:2017-11-16 10:24:47

标签: openerp odoo-10

任何帮助请我是odoo的初学者

我为备份执行此代码(odoo10)

class db_backup_manual(models.Model):
_name = "db.backup.manual.ept"
db_id = fields.Many2one('db.autobackup.ept', required=True, domain=[('active','=','True')], help="Select a database for which you want to generate manual backup.")


def data_save(self, context=None):
    data =  self.read(self)
    #print str(data[0]['db_id'])   
    confs = self.pool.get('db.autobackup.ept').browse(self,[data[0]['db_id'][0]])
   for rec in confs:
        db_list = self.pool.get('db.autobackup.ept').get_db_list(self, [], rec.host, rec.port)
        if rec.name in db_list:
            try:
                if not os.path.isdir(rec.backup_dir):
                    os.makedirs(rec.backup_dir)
            except:
                raise
            result = self.pool.get('db.autobackup.ept').ept_backup(self,[rec.id], rec.name, rec.backup_dir,False,rec.ftp_enable,rec.FTP_id,rec,rec.keep_backup_local)
    return {'type': 'ir.actions.act_window_close'}   

db_backup_manual()

排队:  confs = self.pool.get('db.autobackup.ept').browse(self,[data[0]['db_id'][0]])

我有这个错误:

Exception during JSON request handling KeyError: 'db_id'

0 个答案:

没有答案