[FIX] runbot: use create_single decorator everywhere

All create in odoo are now create_multi. This is a quick and dirty
fix to make it work with runbot.
This commit is contained in:
Xavier-Do 2020-01-10 13:39:47 +01:00
parent 8dcaa6669b
commit 20f97798d9
5 changed files with 7 additions and 6 deletions

View File

@ -135,7 +135,7 @@ class runbot_branch(models.Model):
return False
return True
@api.model
@api.model_create_single
def create(self, vals):
if not vals.get('config_id') and ('use-coverage' in (vals.get('name') or '')):
coverage_config = self.env.ref('runbot.runbot_build_config_test_coverage', raise_if_not_found=False)

View File

@ -198,6 +198,7 @@ class runbot_build(models.Model):
def copy(self, values=None):
raise UserError("Cannot duplicate build!")
@api.model_create_single
def create(self, vals):
branch = self.env['runbot.branch'].search([('id', '=', vals.get('branch_id', False))]) # branche 10174?
if branch.no_build:

View File

@ -32,7 +32,7 @@ class Config(models.Model):
group = fields.Many2one('runbot.build.config', 'Configuration group', help="Group of config's and config steps")
group_name = fields.Char('Group name', related='group.name')
@api.model
@api.model_create_single
def create(self, values):
res = super(Config, self).create(values)
res._check_step_ids_order()
@ -163,7 +163,7 @@ class ConfigStep(models.Model):
copy._write({'protected': False})
return copy
@api.model
@api.model_create_single
def create(self, values):
self._check(values)
return super(ConfigStep, self).create(values)
@ -574,7 +574,7 @@ class ConfigStepOrder(models.Model):
def _onchange_step_id(self):
self.sequence = self.step_id.default_sequence
@api.model
@api.model_create_single
def create(self, values):
if 'sequence' not in values and values.get('step_id'):
values['sequence'] = self.env['runbot.build.config.step'].browse(values.get('step_id')).default_sequence

View File

@ -49,7 +49,7 @@ class RunbotBuildError(models.Model):
if build_error.test_tags and '-' in build_error.test_tags:
raise ValidationError('Build error test_tags should not be negated')
@api.model
@api.model_create_single
def create(self, vals):
cleaners = self.env['runbot.error.regex'].search([('re_type', '=', 'cleaning')])
content = vals.get('content')

View File

@ -38,7 +38,7 @@ class RunboHost(models.Model):
host.nb_testing = count_by_host_state[host.name].get('testing', 0)
host.nb_running = count_by_host_state[host.name].get('running', 0)
@api.model
@api.model_create_single
def create(self, values):
if not 'disp_name' in values:
values['disp_name'] = values['name']