You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3KB

  1. # Copyright (C) 2016-Today: Odoo Community Association (OCA)
  2. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import fields, models
  5. from ..models.github import _GITHUB_TYPE
  6. class WizardLoadGithubModel(models.TransientModel):
  7. _name = "wizard.load.github.model"
  8. _description = "Wizard Load Github Model"
  9. # Columns Section
  10. github_type = fields.Selection(
  11. selection=_GITHUB_TYPE,
  12. string="Github Type Name",
  13. default="organization",
  14. required=True,
  15. )
  16. name = fields.Char(string="Github Name", required=True)
  17. child_update = fields.Boolean(string="Update Child Objects", default=False)
  18. def button_create_from_github(self):
  19. for wizard in self:
  20. if wizard.github_type == "organization":
  21. github_model = self.env["github.organization"]
  22. elif wizard.github_type == "user":
  23. github_model = self.env["res.partner"]
  24. elif wizard.github_type == "repository":
  25. github_model = self.env["github.repository"]
  26. my_obj = github_model.create_from_name(wizard.name)
  27. if wizard.child_update:
  28. my_obj.update_from_github(True)
上海开阖软件有限公司 沪ICP备12045867号-1