@@ -49,24 +49,25 @@ def make_selection(array):
4949class BuildParameters (models .Model ):
5050 _name = 'runbot.build.params'
5151 _description = "All information used by a build to run, should be unique and set on create only"
52+ _inherit = ['runbot.public.model.mixin' ]
5253
5354 # on param or on build?
5455 # execution parametter
5556 commit_link_ids = fields .Many2many ('runbot.commit.link' , copy = True )
5657 commit_ids = fields .Many2many ('runbot.commit' , compute = '_compute_commit_ids' )
5758 version_id = fields .Many2one ('runbot.version' , required = True , index = True )
5859 project_id = fields .Many2one ('runbot.project' , required = True , index = True ) # for access rights
59- trigger_id = fields .Many2one ('runbot.trigger' , index = True ) # for access rights
60- create_batch_id = fields .Many2one ('runbot.batch' , index = True )
61- category = fields .Char ('Category' , index = True ) # normal vs nightly vs weekly, ...
60+ trigger_id = fields .Many2one ('runbot.trigger' , index = True , public = True ) # for access rights
61+ create_batch_id = fields .Many2one ('runbot.batch' , index = True , public = True )
62+ category = fields .Char ('Category' , index = True , public = True ) # normal vs nightly vs weekly, ...
6263 dockerfile_id = fields .Many2one ('runbot.dockerfile' , index = True , default = lambda self : self .env .ref ('runbot.docker_default' , raise_if_not_found = False ))
6364 skip_requirements = fields .Boolean ('Skip requirements.txt auto install' )
6465 # other informations
6566 extra_params = fields .Char ('Extra cmd args' )
66- config_id = fields .Many2one ('runbot.build.config' , 'Run Config' , required = True ,
67+ config_id = fields .Many2one ('runbot.build.config' , 'Run Config' , required = True , public = True ,
6768 default = lambda self : self .env .ref ('runbot.runbot_build_config_default' , raise_if_not_found = False ), index = True )
68- config_data = JsonDictField ('Config Data' )
69- used_custom_trigger = fields .Boolean ('Custom trigger was used to generate this build' )
69+ config_data = JsonDictField ('Config Data' , public = True )
70+ used_custom_trigger = fields .Boolean ('Custom trigger was used to generate this build' , public = True )
7071
7172 build_ids = fields .One2many ('runbot.build' , 'params_id' )
7273 builds_reference_ids = fields .Many2many ('runbot.build' , relation = 'runbot_build_params_references' , copy = True )
@@ -84,6 +85,10 @@ class BuildParameters(models.Model):
8485 ('unique_fingerprint' , 'unique (fingerprint)' , 'avoid duplicate params' ),
8586 ]
8687
88+ @api .model
89+ def _api_request_allow_direct_access (self ):
90+ return False
91+
8792 # @api.depends('version_id', 'project_id', 'extra_params', 'config_id', 'config_data', 'modules', 'commit_link_ids', 'builds_reference_ids')
8893 def _compute_fingerprint (self ):
8994 for param in self :
@@ -141,6 +146,7 @@ class BuildResult(models.Model):
141146
142147 _name = 'runbot.build'
143148 _description = "Build"
149+ _inherit = ['runbot.public.model.mixin' ]
144150
145151 _parent_store = True
146152 _order = 'id desc'
@@ -154,26 +160,26 @@ class BuildResult(models.Model):
154160 no_auto_run = fields .Boolean ('No run' )
155161 # could be a default value, but possible to change it to allow duplicate accros branches
156162
157- description = fields .Char ('Description' , help = 'Informative description' )
158- md_description = fields .Html (compute = '_compute_md_description' , string = 'MD Parsed Description' , help = 'Informative description markdown parsed' , sanitize = False )
159- display_name = fields .Char (compute = '_compute_display_name' )
163+ description = fields .Char ('Description' , help = 'Informative description' , public = True )
164+ md_description = fields .Html (compute = '_compute_md_description' , string = 'MD Parsed Description' , help = 'Informative description markdown parsed' , sanitize = False , public = True )
165+ display_name = fields .Char (compute = '_compute_display_name' , public = True )
160166
161167 # Related fields for convenience
162- version_id = fields .Many2one ('runbot.version' , related = 'params_id.version_id' , store = True , index = True )
163- config_id = fields .Many2one ('runbot.build.config' , related = 'params_id.config_id' , store = True , index = True )
164- trigger_id = fields .Many2one ('runbot.trigger' , related = 'params_id.trigger_id' , store = True , index = True )
165- create_batch_id = fields .Many2one ('runbot.batch' , related = 'params_id.create_batch_id' , store = True , index = True )
168+ version_id = fields .Many2one ('runbot.version' , related = 'params_id.version_id' , store = True , index = True , public = True )
169+ config_id = fields .Many2one ('runbot.build.config' , related = 'params_id.config_id' , store = True , index = True , public = True )
170+ trigger_id = fields .Many2one ('runbot.trigger' , related = 'params_id.trigger_id' , store = True , index = True , public = True )
171+ create_batch_id = fields .Many2one ('runbot.batch' , related = 'params_id.create_batch_id' , store = True , index = True , public = True )
166172
167173 # state machine
168- global_state = fields .Selection (make_selection (state_order ), string = 'Status' , compute = '_compute_global_state' , store = True , recursive = True )
169- local_state = fields .Selection (make_selection (state_order ), string = 'Build Status' , default = 'pending' , required = True , index = True )
170- global_result = fields .Selection (make_selection (result_order ), string = 'Result' , compute = '_compute_global_result' , store = True , recursive = True )
171- local_result = fields .Selection (make_selection (result_order ), string = 'Build Result' , default = 'ok' )
174+ global_state = fields .Selection (make_selection (state_order ), string = 'Status' , compute = '_compute_global_state' , store = True , recursive = True , public = True )
175+ local_state = fields .Selection (make_selection (state_order ), string = 'Build Status' , default = 'pending' , required = True , index = True , public = True )
176+ global_result = fields .Selection (make_selection (result_order ), string = 'Result' , compute = '_compute_global_result' , store = True , recursive = True , public = True )
177+ local_result = fields .Selection (make_selection (result_order ), string = 'Build Result' , default = 'ok' , public = True )
172178
173- requested_action = fields .Selection ([('wake_up' , 'To wake up' ), ('deathrow' , 'To kill' )], string = 'Action requested' , index = True )
179+ requested_action = fields .Selection ([('wake_up' , 'To wake up' ), ('deathrow' , 'To kill' )], string = 'Action requested' , index = True , public = True )
174180 # web infos
175- host = fields .Char ('Host name' )
176- host_id = fields .Many2one ('runbot.host' , string = "Host" , compute = '_compute_host_id' )
181+ host = fields .Char ('Host name' , public = True )
182+ host_id = fields .Many2one ('runbot.host' , string = "Host" , compute = '_compute_host_id' , public = True )
177183 keep_host = fields .Boolean ('Keep host on rebuild and for children' )
178184
179185 port = fields .Integer ('Port' )
@@ -183,7 +189,7 @@ class BuildResult(models.Model):
183189 log_ids = fields .One2many ('ir.logging' , 'build_id' , string = 'Logs' )
184190 error_log_ids = fields .One2many ('ir.logging' , 'build_id' , domain = [('level' , 'in' , ['WARNING' , 'ERROR' , 'CRITICAL' ])], string = 'Error Logs' )
185191 stat_ids = fields .One2many ('runbot.build.stat' , 'build_id' , string = 'Statistics values' )
186- log_list = fields .Char ('Comma separted list of step_ids names with logs' )
192+ log_list = fields .Char ('Comma separted list of step_ids names with logs' , public = True )
187193
188194 active_step = fields .Many2one ('runbot.build.config.step' , 'Active step' )
189195 job = fields .Char ('Active step display name' , compute = '_compute_job' )
@@ -234,13 +240,17 @@ class BuildResult(models.Model):
234240 slot_ids = fields .One2many ('runbot.batch.slot' , 'build_id' )
235241 killable = fields .Boolean ('Killable' )
236242
237- database_ids = fields .One2many ('runbot.database' , 'build_id' )
243+ database_ids = fields .One2many ('runbot.database' , 'build_id' , public = True )
238244 commit_export_ids = fields .One2many ('runbot.commit.export' , 'build_id' )
239245
240246 static_run = fields .Char ('Static run URL' )
241247
242248 access_token = fields .Char ('Token' , default = lambda self : uuid .uuid4 ().hex )
243249
250+ @api .model
251+ def _api_project_id_field_path (self ):
252+ return 'params_id.project_id'
253+
244254 @api .depends ('description' , 'params_id.config_id' )
245255 def _compute_display_name (self ):
246256 for build in self :
0 commit comments