22# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
33# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44
5- from odoo import fields , models
5+ from odoo import exceptions , fields , models
66
77
88class WizardLoadGithubModel (models .TransientModel ):
@@ -28,10 +28,34 @@ class WizardLoadGithubModel(models.TransientModel):
2828 def button_create_from_github (self ):
2929 for wizard in self :
3030 if wizard .github_type == "organization" :
31+ if "/" in wizard .name :
32+ raise exceptions .UserError (
33+ self .env ._ (
34+ "You selected 'Organization' but provided a repository "
35+ "name containing a '/'. Please select 'Repository' "
36+ "as the Github Type Name instead."
37+ )
38+ )
3139 github_model = self .env ["github.organization" ]
3240 elif wizard .github_type == "user" :
41+ if "/" in wizard .name :
42+ raise exceptions .UserError (
43+ self .env ._ (
44+ "You selected 'User' but provided a repository name"
45+ " containing a '/'. Please select 'Repository' "
46+ "as the Github Type Name instead."
47+ )
48+ )
3349 github_model = self .env ["res.partner" ]
3450 elif wizard .github_type == "repository" :
51+ if "/" not in wizard .name :
52+ raise exceptions .UserError (
53+ self .env ._ (
54+ "You selected 'Repository' but provided a name "
55+ "without a '/'. Repositories should be in the format "
56+ "'organization/repository'."
57+ )
58+ )
3559 github_model = self .env ["github.repository" ]
3660 my_obj = github_model .create_from_name (wizard .name )
3761 if wizard .child_update :
0 commit comments