Browse Source

Tenames and typos.

12.0-mig-module_prototyper_last
Jairo Llopis 9 years ago
committed by Vladislav Shepilov
parent
commit
7157529ab8
  1. 10
      base_multi_image/models/image.py
  2. 2
      base_multi_image/models/owner.py

10
base_multi_image/models/image.py

@ -14,7 +14,7 @@ from openerp import tools
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class ImageABC(models.Model):
class Image(models.Model):
_name = "base_multi_image.image" _name = "base_multi_image.image"
_sql_constraints = [ _sql_constraints = [
('uniq_name_owner', 'UNIQUE(owner_id, owner_model, name)', ('uniq_name_owner', 'UNIQUE(owner_id, owner_model, name)',
@ -139,7 +139,7 @@ class ImageABC(models.Model):
_('The image filestore cannot be created, %s') % e) _('The image filestore cannot be created, %s') % e)
@api.model @api.model
def _make_pretty(self, name):
def _make_name_pretty(self, name):
return name.replace('_', ' ').capitalize() return name.replace('_', ' ').capitalize()
@api.onchange('url') @api.onchange('url')
@ -147,20 +147,20 @@ class ImageABC(models.Model):
if self.url: if self.url:
filename = self.url.split('/')[-1] filename = self.url.split('/')[-1]
self.name, self.extension = os.path.splitext(filename) self.name, self.extension = os.path.splitext(filename)
self.name = self._make_pretty(self.name)
self.name = self._make_name_pretty(self.name)
@api.onchange('path') @api.onchange('path')
def _onchange_path(self): def _onchange_path(self):
if self.path: if self.path:
self.name, self.extension = os.path.splitext(os.path.basename( self.name, self.extension = os.path.splitext(os.path.basename(
self.path)) self.path))
self.name = self._make_pretty(self.name)
self.name = self._make_name_pretty(self.name)
@api.onchange('filename') @api.onchange('filename')
def _onchange_filename(self): def _onchange_filename(self):
if self.filename: if self.filename:
self.name, self.extension = os.path.splitext(self.filename) self.name, self.extension = os.path.splitext(self.filename)
self.name = self._make_pretty(self.name)
self.name = self._make_name_pretty(self.name)
@api.constrains('storage', 'url') @api.constrains('storage', 'url')
def _check_url(self): def _check_url(self):

2
base_multi_image/models/owner.py

@ -35,7 +35,7 @@ class Owner(models.AbstractModel):
@api.multi @api.multi
@api.depends('image_ids') @api.depends('image_ids')
def _get_multi_image(self): def _get_multi_image(self):
"""Get a the main image for this object.
"""Get the main image for this object.
This is provided as a compatibility layer for submodels that already This is provided as a compatibility layer for submodels that already
had one image per record. had one image per record.

Loading…
Cancel
Save