# -*- coding: utf-8 -*-
import os
from openerp import models, fields, api
import logging
_logger = logging.getLogger(__name__)


class database_backup(models.Model):
    _name = 'db.database.backup'
    _description = 'Database Backup'
    _order = "create_date desc"

    database_id = fields.Many2one(
        'db.database',
        string='Database',
        readonly=True,
        required=True
    )
    date = fields.Datetime(
        string='Date',
        readonly=True,
        required=True
    )
    name = fields.Char(
        string='Name',
        readonly=True,
        required=True
    )
    path = fields.Char(
        string='Path',
        readonly=True,
        required=True
    )
    full_path = fields.Char(
        string='Path',
        compute='get_full_path',
    )
    type = fields.Selection(
        [('manual', 'Manual'), ('daily', 'Daily'),
         ('weekly', 'Weekly'), ('monthly', 'Monthly')],
        string='Type',
        required=True
    )

    @api.one
    @api.depends('path', 'name')
    def get_full_path(self):
        self.full_path = os.path.join(self.path, self.name)

    @api.multi
    def unlink(self):
        try:
            os.remove(self.full_path)
        except Exception, e:
            _logger.warning(
                'Unable to remoove database file on %s, this is what we get:\
                \n %s' % (self.full_path, e.strerror))
        return super(database_backup, self).unlink()

@@ -1140,32 +1140,64 @@
 f unlink(self):%0A
+        for backup in self:%0A    
         try:%0A   
@@ -1193,16 +1193,20 @@
    try:%0A
+    
         
@@ -1219,20 +1219,22 @@
 .remove(
-self
+backup
 .full_pa
@@ -1237,16 +1237,20 @@
 l_path)%0A
+    
         
@@ -1270,16 +1270,20 @@
 ion, e:%0A
+    
         
@@ -1319,16 +1319,20 @@
         
+    
 'Unable 
@@ -1401,16 +1401,20 @@
         
+    
 %5Cn %25s' %25
@@ -1415,20 +1415,22 @@
  %25s' %25 (
-self
+backup
 .full_pa

FIX db backup