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.

49 lines
1.5KB

  1. # Copyright (C) 2017-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. class WizardCreateTeam(models.TransientModel):
  6. _name = "wizard.create.team"
  7. _description = "Wizard Create Team"
  8. _inherit = ["github.team"]
  9. # Overload Columns Section
  10. name = fields.Char(readonly=False)
  11. description = fields.Char(readonly=False)
  12. organization_id = fields.Many2one(readonly=False)
  13. privacy = fields.Selection(readonly=False)
  14. # Columns Section
  15. wizard_partner_ids = fields.Many2many(
  16. string="Team Members",
  17. comodel_name="res.partner",
  18. domain="[('github_login', '!=', False)]",
  19. )
  20. wizard_repository_ids = fields.Many2many(
  21. string="Team Repositories", comodel_name="github.repository"
  22. )
  23. def get_github_data_from_odoo(self):
  24. self.ensure_one()
  25. res = super().get_github_data_from_odoo()
  26. res.update(
  27. {
  28. "maintainers": [
  29. x.github_login for x in self.wizard_partner_ids if x.github_login
  30. ],
  31. "repo_names": [
  32. x.github_login for x in self.wizard_repository_ids if x.github_login
  33. ],
  34. }
  35. )
  36. return res
  37. def button_create_in_github(self):
  38. self.ensure_one()
  39. new_item = self.create_in_github(self.env["github.team"])
  40. return new_item.get_action()
上海开阖软件有限公司 沪ICP备12045867号-1