[FIX]GOLEM Admin : allow user creation even with auth_signup addon installed

This commit is contained in:
Fabien BOURGEOIS 2018-09-26 13:22:42 +02:00
parent 429302448f
commit 5e983043e5
4 changed files with 60 additions and 1 deletions

View File

@ -14,3 +14,5 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import models

View File

@ -22,7 +22,7 @@
- New application on top menu ; - New application on top menu ;
- Management of users and groups, companies ; - Management of users and groups, companies ;
- Good default access / rights to do. ''', - Good default access / rights to do. ''',
'version': '10.0.0.1.0', 'version': '10.0.0.1.3',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import res_partner

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Partner adaptations """
from odoo import models, fields, api
class Partner(models.Model):
""" Partner adaptations """
_inherit = 'res.partner'
signup_token = fields.Char(groups="golem_base.group_golem_manager")
signup_type = fields.Char(groups="golem_base.group_golem_manager")
signup_expiration = fields.Datetime(groups="golem_base.group_golem_manager")
@api.multi
def write(self, vals):
""" Overwrite native function to workaround admin only write on fields
signup*, as it's impossible to overwrite groups attribute """
if (('signup_token' in vals or 'signup_type' in vals or
'signup_expiration' in vals)
and self.env.user.has_group('golem_base.group_golem_manager')):
return super(Partner, self.sudo()).write(vals)
return super(Partner, self).write(vals)