Browse Source

[MIG][9.0][auth_supplier] Migrate. (#434)

* [ADD] auth_supplier: New Module.

* [ADD] auth_supplier: New Module.

* [FIX] auth_supplier: Change author order.

* [MIG][9.0][auth_supplier] Migrate.

Update to v9, with mostly cosmetic changes.

* Update XML tags.

* Inform about the need to have technical features enabled.

* Don't assume website is installed.

* Add known issue
pull/443/head
Yajo 9 years ago
committed by Moises Lopez - https://www.vauxoo.com/
parent
commit
5b7c2eaeac
  1. 80
      auth_supplier/README.rst
  2. 7
      auth_supplier/__init__.py
  3. 25
      auth_supplier/__openerp__.py
  4. 6
      auth_supplier/controllers/__init__.py
  5. 14
      auth_supplier/controllers/main.py
  6. 49
      auth_supplier/i18n/de.po
  7. 48
      auth_supplier/i18n/en.po
  8. 49
      auth_supplier/i18n/es.po
  9. 49
      auth_supplier/i18n/fr.po
  10. 49
      auth_supplier/i18n/it.po
  11. 48
      auth_supplier/i18n/pt_BR.po
  12. 49
      auth_supplier/i18n/sl.po
  13. 49
      auth_supplier/i18n/tr.po
  14. 6
      auth_supplier/models/__init__.py
  15. 23
      auth_supplier/models/res_users.py
  16. 14
      auth_supplier/security/auth_supplier_security.xml
  17. BIN
      auth_supplier/static/description/icon.png
  18. 6
      auth_supplier/tests/__init__.py
  19. 24
      auth_supplier/tests/test_auth_supplier.py
  20. 18
      auth_supplier/views/auth_supplier_view.xml

80
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
<https://github.com/OCA/server-tools/pull/434#discussion-diff-64883758>`_.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/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 <rafabn@antiun.com>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Carlos Dauden <carlos@incaser.es>
* Sergio Teruel <sergio@incaser.es>
* Jairo Llopis <jairo.llopis@tecnativa.com>
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.

7
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

25
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 <jairo.llopis@tecnativa.com>
# 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,
}

6
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

14
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 <jairo.llopis@tecnativa.com>
# 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)

49
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 <rs@techno-flex.de>, 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 <rs@techno-flex.de>\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"

48
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 <transbot@odoo-community.org>\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"

49
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"

49
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 <christophe.chauvet@gmail.com>, 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 <christophe.chauvet@gmail.com>\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"

49
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"

48
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"

49
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č <m.mozetic@matmoz.si>, 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č <m.mozetic@matmoz.si>\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"

49
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 <aaltinisik@altinkaya.com.tr>, 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 <aaltinisik@altinkaya.com.tr>\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"

6
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

23
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 <jairo.llopis@tecnativa.com>
# 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

14
auth_supplier/security/auth_supplier_security.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.module.category" id="module_auth_supplier">
<field name="name">Auth Supplier</field>
<field name="sequence">100</field>
</record>
<record id="group_auth_supplier" model="res.groups">
<field name="name">Portal Supplier</field>
<field name="category_id" ref="module_auth_supplier"/>
</record>
</odoo>

BIN
auth_supplier/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

6
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

24
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)

18
auth_supplier/views/auth_supplier_view.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="auth_supplier.fields"
inherit_id="auth_signup.fields"
name="Auth Signup/ResetPassword form fields">
<xpath expr="//div[@class='form-group field-login']" position="before">
<div class="form-group field-type">
<label for="account_type" class="control-label">Account Type</label>
<select class="form-control" name="account_type">
<option value="customer" selected="selected">Customer</option>
<option value="supplier">Supplier</option>
</select>
</div>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save