diff --git a/auth_supplier/README.rst b/auth_supplier/README.rst new file mode 100644 index 000000000..291ed89ab --- /dev/null +++ b/auth_supplier/README.rst @@ -0,0 +1,80 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============= +Auth Supplier +============= + +This module was written to extends the functionality of auth signup +and allows the user to create an account as a supplier. + +Configuration +============= + +To enable users to create accounts: + +* *Developer mode* should be activated first to have access to technical features. +* Go to *Settings > General settings*. +* Enable *Allow external users to sign up*. +* Enable *Activate the customer portal*. + +Usage +===== + +To use this module, you need to: + +* Log out. +* If you have a website, in home page press *Sign in*. +* Press *Sign up*. +* Select *Supplier* in account type. +* Fill the form. + +.. 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 + +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 + `_. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Rafael Blasco +* Pedro M. Baeza +* Carlos Dauden +* Sergio Teruel +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/auth_supplier/__init__.py b/auth_supplier/__init__.py new file mode 100644 index 000000000..670c70c9c --- /dev/null +++ b/auth_supplier/__init__.py @@ -0,0 +1,7 @@ +# -*- 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 models +from . import controllers diff --git a/auth_supplier/__openerp__.py b/auth_supplier/__openerp__.py new file mode 100644 index 000000000..29994ee9d --- /dev/null +++ b/auth_supplier/__openerp__.py @@ -0,0 +1,25 @@ +# -*- 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 + +{ + 'name': "Auth Supplier", + 'category': 'Tools', + 'version': '9.0.1.0.0', + 'depends': [ + 'auth_signup', + ], + 'data': [ + 'security/auth_supplier_security.xml', + 'views/auth_supplier_view.xml', + ], + 'author': 'Antiun Ingeniería S.L., ' + 'Incaser Informatica S.L., ' + "Tecnativa, " + 'Odoo Community Association (OCA)', + 'website': 'http://www.incaser.es', + 'license': 'AGPL-3', + 'installable': True, +} diff --git a/auth_supplier/controllers/__init__.py b/auth_supplier/controllers/__init__.py new file mode 100644 index 000000000..49f5bc60d --- /dev/null +++ b/auth_supplier/controllers/__init__.py @@ -0,0 +1,6 @@ +# -*- 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 main diff --git a/auth_supplier/controllers/main.py b/auth_supplier/controllers/main.py new file mode 100644 index 000000000..e810a5231 --- /dev/null +++ b/auth_supplier/controllers/main.py @@ -0,0 +1,14 @@ +# -*- 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.addons.auth_signup.controllers.main import AuthSignupHome +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)) + return super(AuthSignupHome, self)._signup_with_values(token, values) diff --git a/auth_supplier/i18n/de.po b/auth_supplier/i18n/de.po new file mode 100644 index 000000000..32602493f --- /dev/null +++ b/auth_supplier/i18n/de.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Rudolf Schnapka , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-19 14:44+0000\n" +"PO-Revision-Date: 2016-01-18 14:17+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Kontoart" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "Auth-Lieferant" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Kunde" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portal-Lieferant" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Lieferant" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Benutzer" diff --git a/auth_supplier/i18n/en.po b/auth_supplier/i18n/en.po new file mode 100644 index 000000000..217809e8d --- /dev/null +++ b/auth_supplier/i18n/en.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-27 14:01+0000\n" +"PO-Revision-Date: 2015-10-30 14:43+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: English (http://www.transifex.com/oca/OCA-server-tools-8-0/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Account Type" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "Auth Supplier" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Customer" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portal Supplier" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Supplier" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Users" diff --git a/auth_supplier/i18n/es.po b/auth_supplier/i18n/es.po new file mode 100644 index 000000000..a7ce20b81 --- /dev/null +++ b/auth_supplier/i18n/es.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Antonio Trueba, 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-19 14:44+0000\n" +"PO-Revision-Date: 2016-02-16 15:12+0000\n" +"Last-Translator: Antonio Trueba\n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Tipo de cuenta" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "Proveedor de autenticación" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Cliente" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Proveedor" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Usuarios" diff --git a/auth_supplier/i18n/fr.po b/auth_supplier/i18n/fr.po new file mode 100644 index 000000000..79b3eb542 --- /dev/null +++ b/auth_supplier/i18n/fr.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Christophe kryskool , 2015 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-27 14:01+0000\n" +"PO-Revision-Date: 2015-11-21 17:37+0000\n" +"Last-Translator: Christophe kryskool \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Type de compte" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "Identification fournisseur" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Client" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portail fournisseur" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Fournisseur" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Utilisateurs" diff --git a/auth_supplier/i18n/it.po b/auth_supplier/i18n/it.po new file mode 100644 index 000000000..c22422288 --- /dev/null +++ b/auth_supplier/i18n/it.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Paolo Valier, 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-03-17 15:36+0000\n" +"PO-Revision-Date: 2016-03-13 09:00+0000\n" +"Last-Translator: Paolo Valier\n" +"Language-Team: Italian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Tipo di Account" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Cliente" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portale del Fornitore" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Fornitore" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Utenti" diff --git a/auth_supplier/i18n/pt_BR.po b/auth_supplier/i18n/pt_BR.po new file mode 100644 index 000000000..543699097 --- /dev/null +++ b/auth_supplier/i18n/pt_BR.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-27 14:01+0000\n" +"PO-Revision-Date: 2015-10-30 14:43+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Usuários" diff --git a/auth_supplier/i18n/sl.po b/auth_supplier/i18n/sl.po new file mode 100644 index 000000000..5856c5f5c --- /dev/null +++ b/auth_supplier/i18n/sl.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Matjaž Mozetič , 2015 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-27 14:01+0000\n" +"PO-Revision-Date: 2015-10-31 05:17+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Tip konta" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "Overjanje dobavitelja" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Kupec" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portal dobaviteljev" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Dobavitelj" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Uporabniki" diff --git a/auth_supplier/i18n/tr.po b/auth_supplier/i18n/tr.po new file mode 100644 index 000000000..ad1c46674 --- /dev/null +++ b/auth_supplier/i18n/tr.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_supplier +# +# Translators: +# Ahmet Altınışık , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-01-19 14:44+0000\n" +"PO-Revision-Date: 2016-01-31 14:58+0000\n" +"Last-Translator: Ahmet Altınışık \n" +"Language-Team: Turkish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Account Type" +msgstr "Hesap Tipi" + +#. module: auth_supplier +#: model:ir.module.category,name:auth_supplier.module_auth_supplier +msgid "Auth Supplier" +msgstr "" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Customer" +msgstr "Müşteri" + +#. module: auth_supplier +#: model:res.groups,name:auth_supplier.group_auth_supplier +msgid "Portal Supplier" +msgstr "Portal Tedarikçi" + +#. module: auth_supplier +#: view:website:auth_signup.fields +msgid "Supplier" +msgstr "Tedarikçi" + +#. module: auth_supplier +#: model:ir.model,name:auth_supplier.model_res_users +msgid "Users" +msgstr "Kullanıcılar" diff --git a/auth_supplier/models/__init__.py b/auth_supplier/models/__init__.py new file mode 100644 index 000000000..592a4c752 --- /dev/null +++ b/auth_supplier/models/__init__.py @@ -0,0 +1,6 @@ +# -*- 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 new file mode 100644 index 000000000..12b943c96 --- /dev/null +++ b/auth_supplier/models/res_users.py @@ -0,0 +1,23 @@ +# -*- 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 new file mode 100644 index 000000000..c8603cfed --- /dev/null +++ b/auth_supplier/security/auth_supplier_security.xml @@ -0,0 +1,14 @@ + + + + + Auth Supplier + 100 + + + + Portal Supplier + + + + diff --git a/auth_supplier/static/description/icon.png b/auth_supplier/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/auth_supplier/static/description/icon.png differ diff --git a/auth_supplier/tests/__init__.py b/auth_supplier/tests/__init__.py new file mode 100644 index 000000000..79276a68f --- /dev/null +++ b/auth_supplier/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- 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 new file mode 100644 index 000000000..e121b8e73 --- /dev/null +++ b/auth_supplier/tests/test_auth_supplier.py @@ -0,0 +1,24 @@ +# -*- 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) diff --git a/auth_supplier/views/auth_supplier_view.xml b/auth_supplier/views/auth_supplier_view.xml new file mode 100644 index 000000000..1667f268b --- /dev/null +++ b/auth_supplier/views/auth_supplier_view.xml @@ -0,0 +1,18 @@ + + + + + +