• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OCA / maintainer-tools / 13228537945

09 Feb 2025 06:34PM UTC coverage: 35.131%. Remained the same
13228537945

Pull #644

github

web-flow
Merge 8b3aeb3fa into 16f1fc1f8
Pull Request #644: Ignore archived projects

437 of 1188 branches covered (36.78%)

645 of 1836 relevant lines covered (35.13%)

3.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/tools/oca_sync_users.py
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# License AGPLv3 (https://www.gnu.org/licenses/agpl-3.0-standalone.html)
4
"""
5
Create res.users for OCA members with a github login filled in.
6

7
This enables adding them to project teams in the OCA instance.
8
"""
9

10
from __future__ import absolute_import, print_function
×
11

12
import xmlrpclib
×
13

14
from .odoo_login import get_parser, login
×
15

16

17
def main():
×
18
    parser = get_parser(with_help=True)
×
19
    args = parser.parse_args()
×
20
    client = login(args.username, args.store)
×
21
    ResPartner = client.ResPartner
×
22
    ResUsers = client.ResUsers
×
23
    ResGroups = client.ResGroups
×
24
    grp_project_user = ResGroups.get("project.group_project_user")
×
25
    members_with_gh = ResPartner.search(
×
26
        [("x_github_login", "!=", False), ("user_ids", "=", False)]
27
    )
28
    if not members_with_gh:
×
29
        return
×
30
    for partner in ResPartner.browse(members_with_gh):
×
31
        try:
×
32
            user = ResUsers.create(
×
33
                {
34
                    "partner_id": partner.id,
35
                    "login": partner.email,
36
                    "groups_id": [(4, grp_project_user.id, 0)],
37
                }
38
            )
39
        except xmlrpclib.Fault:
×
40
            print(
×
41
                "unable to create user for partner %r (%s) : "
42
                "probable email address issue" % (partner.x_github_login, partner.id)
43
            )
44
        else:
45
            print("created user %r for partner %r" % (user, partner.x_github_login))
×
46

47

48
if __name__ == "__main__":
×
49
    main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc