mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Change CI to GitHub actions
Use copier template from oca/oca-addons-repo-template Target Python3.8 Apply linting Fix a missing call to super
This commit is contained in:
@@ -1,44 +1,46 @@
|
||||
# Copyright 2019 Camptocamp SA
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
from odoo import models, fields, api, _
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
|
||||
_inherit = 'res.partner'
|
||||
_inherit = "res.partner"
|
||||
|
||||
name = fields.Char()
|
||||
url_file = fields.FileURL(
|
||||
storage_location='s3',
|
||||
filename='url_file_fname',
|
||||
storage_path='partner'
|
||||
storage_location="s3", filename="url_file_fname", storage_path="partner"
|
||||
)
|
||||
url_file_fname = fields.Char()
|
||||
|
||||
url_image = fields.FileURL(
|
||||
storage_location='s3',
|
||||
filename='url_image_fname',
|
||||
storage_path='partner_image',
|
||||
storage_location="s3",
|
||||
filename="url_image_fname",
|
||||
storage_path="partner_image",
|
||||
)
|
||||
url_image_fname = fields.Char()
|
||||
|
||||
@api.constrains('url_file', 'url_file_fname')
|
||||
@api.constrains("url_file", "url_file_fname")
|
||||
def _check_url_file_fname(self):
|
||||
rec = self.search([('url_file_fname', '=', self.url_file_fname)])
|
||||
rec = self.search([("url_file_fname", "=", self.url_file_fname)])
|
||||
if len(rec) > 1:
|
||||
raise ValidationError(_(
|
||||
"This file name is already used on an existing record. "
|
||||
"Please use another file name or delete the url_file on :\n"
|
||||
"Model: %s Id: %s" % (self._name, rec.id)
|
||||
))
|
||||
raise ValidationError(
|
||||
_(
|
||||
"This file name is already used on an existing record. "
|
||||
"Please use another file name or delete the url_file on :\n"
|
||||
"Model: %s Id: %s" % (self._name, rec.id)
|
||||
)
|
||||
)
|
||||
|
||||
@api.constrains('url_image', 'url_image_fname')
|
||||
@api.constrains("url_image", "url_image_fname")
|
||||
def _check_url_image_fname(self):
|
||||
rec = self.search([('url_image_fname', '=', self.url_image_fname)])
|
||||
rec = self.search([("url_image_fname", "=", self.url_image_fname)])
|
||||
if len(rec) > 1:
|
||||
raise ValidationError(_(
|
||||
"This file name is already used on an existing record. "
|
||||
"Please use another file name or delete the url_image on :\n"
|
||||
"Model: %s Id: %s" % (self._name, rec.id)
|
||||
))
|
||||
raise ValidationError(
|
||||
_(
|
||||
"This file name is already used on an existing record. "
|
||||
"Please use another file name or delete the url_image on :\n"
|
||||
"Model: %s Id: %s" % (self._name, rec.id)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Copyright 2019 Camptocamp SA
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
|
||||
_inherit = 'res.users'
|
||||
_inherit = "res.users"
|
||||
|
||||
partner_url_file = fields.FileURL(related='partner_id.url_file')
|
||||
partner_url_file_fname = fields.Char(related='partner_id.url_file_fname')
|
||||
partner_url_file = fields.FileURL(related="partner_id.url_file")
|
||||
partner_url_file_fname = fields.Char(related="partner_id.url_file_fname")
|
||||
|
||||
Reference in New Issue
Block a user