diff --git a/auth_supplier/README.rst b/auth_supplier/README.rst index fe5ca8547..188b34b31 100644 --- a/auth_supplier/README.rst +++ b/auth_supplier/README.rst @@ -7,9 +7,8 @@ Auth Supplier ============= This module was written to extends the functionality of auth signup and allows -the user to create an account as a supplier, marking him as with permissions -for a supplier portal (although nothing is implemented for that portal, other -modules should do that). +the user to create an account as a supplier or customer, marking his related +created partner as such. Configuration ============= @@ -29,18 +28,9 @@ To use this module, you need to: * Log out. * If you have a website, in home page press *Sign in*. * Press *Sign up* to go to `the sign up page `_. -* Select *Supplier* in account type. +* Select *Supplier* or *Customer* in account type. * Fill the form. -If you want to give permissions to anybody for the supplier portal: - -#. Go to *Contacts*. -#. Choose a supplier. -#. Go to *Action > Portal Access Management*. -#. Choose *Other Extra Rights / Supplier Portal*. -#. Choose contacts to be *In Portal*. -#. Press *Apply*. - .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/149/9.0 @@ -50,10 +40,8 @@ Known issues / Roadmap * If you have nothing in the portal, the user will be redirected to an empty page. -* When the user signs up as *Customer*, it is not really marked as such in the - backend, it's just not marked as supplier. Is this expected behavior or bug? - `Relevant discussion - `_. +* Tests are not possible due to https://github.com/odoo/odoo/issues/12237. + They should be added when that is fixed. Bug Tracker =========== diff --git a/auth_supplier/__init__.py b/auth_supplier/__init__.py index 670c70c9c..5b29f003b 100644 --- a/auth_supplier/__init__.py +++ b/auth_supplier/__init__.py @@ -3,5 +3,4 @@ # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from . import models from . import controllers diff --git a/auth_supplier/__openerp__.py b/auth_supplier/__openerp__.py index f8e682cbe..1d584e559 100644 --- a/auth_supplier/__openerp__.py +++ b/auth_supplier/__openerp__.py @@ -7,12 +7,11 @@ { 'name': "Auth Supplier", 'category': 'Portal', - 'version': '9.0.1.1.0', + 'version': '9.0.2.0.0', 'depends': [ 'auth_signup', ], 'data': [ - 'security/auth_supplier_security.xml', 'views/auth_supplier_view.xml', ], 'author': 'Antiun Ingeniería S.L., ' diff --git a/auth_supplier/controllers/main.py b/auth_supplier/controllers/main.py index e810a5231..196d8888c 100644 --- a/auth_supplier/controllers/main.py +++ b/auth_supplier/controllers/main.py @@ -10,5 +10,7 @@ from openerp.http import request class AuthSignupHome(AuthSignupHome): def _signup_with_values(self, token, values): - values.update(account_type=request.params.get('account_type', False)) + account_type = request.params.get('account_type') + if account_type in {"customer", "supplier"}: + values.setdefault(account_type, True) return super(AuthSignupHome, self)._signup_with_values(token, values) diff --git a/auth_supplier/models/__init__.py b/auth_supplier/models/__init__.py deleted file mode 100644 index 592a4c752..000000000 --- a/auth_supplier/models/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel -# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from . import res_users diff --git a/auth_supplier/models/res_users.py b/auth_supplier/models/res_users.py deleted file mode 100644 index 12b943c96..000000000 --- a/auth_supplier/models/res_users.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel -# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden -# © 2016 Jairo Llopis -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from openerp import models, api - - -class ResUsers(models.Model): - _inherit = "res.users" - - @api.model - def _signup_create_user(self, values): - account_type = values.pop('account_type', False) - res = super(ResUsers, self)._signup_create_user(values) - if isinstance(res, int): - user = self.env['res.users'].browse(res) - if account_type == 'supplier': - user.partner_id.supplier = True - user.groups_id |= self.env.ref( - 'auth_supplier.group_auth_supplier') - return res diff --git a/auth_supplier/security/auth_supplier_security.xml b/auth_supplier/security/auth_supplier_security.xml deleted file mode 100644 index 0108e381f..000000000 --- a/auth_supplier/security/auth_supplier_security.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Supplier Portal - - - - diff --git a/auth_supplier/tests/__init__.py b/auth_supplier/tests/__init__.py deleted file mode 100644 index 79276a68f..000000000 --- a/auth_supplier/tests/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel -# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from . import test_auth_supplier diff --git a/auth_supplier/tests/test_auth_supplier.py b/auth_supplier/tests/test_auth_supplier.py deleted file mode 100644 index e121b8e73..000000000 --- a/auth_supplier/tests/test_auth_supplier.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel -# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from openerp.tests.common import TransactionCase - - -class TestSAuthSupplier(TransactionCase): - def setUp(self): - super(TestSAuthSupplier, self).setUp() - ir_config_parameter = self.env['ir.config_parameter'] - ir_config_parameter.set_param('auth_signup.allow_uninvited', 'True') - - def test_user_signup(self): - values = { - 'login': 'test@test.com', - 'name': 'test', - 'password': '1234', - 'account_type': 'supplier' - } - user_obj = self.env['res.users'] - user = user_obj.browse(user_obj._signup_create_user(values)) - self.assertTrue(user.partner_id.supplier)