Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Susahnt | MPOC-631 Training: OpenERP - Duplicate Currency is Shown #37

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added auth_signup/.___init__.py
Binary file not shown.
Binary file added auth_signup/.___openerp__.py
Binary file not shown.
Binary file added auth_signup/._auth_signup_data.xml
Binary file not shown.
Binary file added auth_signup/._controllers
Binary file not shown.
Binary file added auth_signup/._i18n
Binary file not shown.
Binary file added auth_signup/._res_config.py
Binary file not shown.
Binary file added auth_signup/._res_config.xml
Binary file not shown.
Binary file added auth_signup/._res_users.py
Binary file not shown.
Binary file added auth_signup/._res_users_view.xml
Binary file not shown.
Binary file added auth_signup/._static
Binary file not shown.
24 changes: 24 additions & 0 deletions auth_signup/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.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/>
#
##############################################################################

import controllers
import res_config
import res_users
45 changes: 45 additions & 0 deletions auth_signup/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-today OpenERP SA (<http://www.openerp.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/>
#
##############################################################################

{
'name': 'Signup',
'description': """
Allow users to sign up and reset their password
===============================================
""",
'author': 'OpenERP SA',
'version': '1.0',
'category': 'Authentication',
'website': 'http://www.openerp.com',
'installable': True,
'auto_install': True,
'depends': [
'base_setup',
'email_template',
],
'data': [
'auth_signup_data.xml',
'res_config.xml',
'res_users_view.xml',
],
'js': ['static/src/js/auth_signup.js'],
'qweb': ['static/src/xml/auth_signup.xml'],
}
71 changes: 71 additions & 0 deletions auth_signup/auth_signup_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">

<!-- Default template user for new users signing in -->
<record id="default_template_user" model="res.users">
<field name="name">Template User</field>
<field name="login">portaltemplate</field>
<!-- No password: this template user doesn't need to log in -->
<field name="password"></field>
<field name="active" eval="False"/>
<!-- Avoid auto-including this user in any default group, just like a typical portal member -->
<field name="groups_id" eval="[(5,)]"/>
</record>

<record id="default_template_user_config" model="ir.config_parameter">
<field name="key">auth_signup.template_user_id</field>
<field name="value" ref="default_template_user"/>
</record>

<!-- Email template for reset password -->
<record id="reset_password_email" model="email.template">
<field name="name">Reset Password</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email}>]]></field>
<field name="email_to">${object.email}</field>
<field name="subject">Password reset</field>
<field name="body_html"><![CDATA[
<p>A password reset was requested for the OpenERP account linked to this email.</p>

<p>You may change your password by following <a href="${object.signup_url}">this link</a>.</p>

<p>Note: If you do not expect this, you can safely ignore this email.</p>]]></field>
</record>

<!-- Email template for new users -->
<record id="set_password_email" model="email.template">
<field name="name">OpenERP Enterprise Connection</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email}>]]></field>
<field name="email_to">${object.email}</field>
<field name="subject"><![CDATA[${object.company_id.name} invitation to connect on OpenERP]]></field>
<field name="body_html">
<![CDATA[
<p>
${object.name},
</p>
<p>
You have been invited to connect to "${object.company_id.name}" in order to get access to your documents in OpenERP.
</p>
<p>
To accept the invitation, click on the following link:
</p>
<ul>
<li><a href="${object.signup_url}">Accept invitation to "${object.company_id.name}"</a></li>
</ul>
<p>
Thanks,
</p>
<pre>
--
${object.company_id.name or ''}
${object.company_id.email or ''}
${object.company_id.phone or ''}
</pre>
]]>
</field>
</record>

</data>
</openerp>
Binary file added auth_signup/controllers/.___init__.py
Binary file not shown.
Binary file added auth_signup/controllers/._main.py
Binary file not shown.
3 changes: 3 additions & 0 deletions auth_signup/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import main

# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
84 changes: 84 additions & 0 deletions auth_signup/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.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/>
#
##############################################################################
import logging

import openerp
from openerp.modules.registry import RegistryManager
from ..res_users import SignupError

_logger = logging.getLogger(__name__)

class Controller(openerp.addons.web.http.Controller):
_cp_path = '/auth_signup'

@openerp.addons.web.http.jsonrequest
def get_config(self, req, dbname):
""" retrieve the module config (which features are enabled) for the login page """
registry = RegistryManager.get(dbname)
with registry.cursor() as cr:
icp = registry.get('ir.config_parameter')
config = {
'signup': icp.get_param(cr, openerp.SUPERUSER_ID, 'auth_signup.allow_uninvited') == 'True',
'reset_password': icp.get_param(cr, openerp.SUPERUSER_ID, 'auth_signup.reset_password') == 'True',
}
return config

@openerp.addons.web.http.jsonrequest
def retrieve(self, req, dbname, token):
""" retrieve the user info (name, login or email) corresponding to a signup token """
registry = RegistryManager.get(dbname)
with registry.cursor() as cr:
res_partner = registry.get('res.partner')
user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token)
return user_info

@openerp.addons.web.http.jsonrequest
def signup(self, req, dbname, token, name, login, password):
""" sign up a user (new or existing)"""
values = {'name': name, 'login': login, 'password': password}
try:
self._signup_with_values(req, dbname, token, values)
except SignupError, e:
return {'error': openerp.tools.exception_to_unicode(e)}
return {}

def _signup_with_values(self, req, dbname, token, values):
registry = RegistryManager.get(dbname)
with registry.cursor() as cr:
res_users = registry.get('res.users')
res_users.signup(cr, openerp.SUPERUSER_ID, values, token)

@openerp.addons.web.http.jsonrequest
def reset_password(self, req, dbname, login):
""" retrieve user, and perform reset password """
registry = RegistryManager.get(dbname)
with registry.cursor() as cr:
try:
res_users = registry.get('res.users')
res_users.reset_password(cr, openerp.SUPERUSER_ID, login)
cr.commit()
except Exception as e:
# signup error
_logger.exception('error when resetting password')
raise(e)
return True

# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
Binary file added auth_signup/i18n/._ar.po
Binary file not shown.
Binary file added auth_signup/i18n/._auth_signup.pot
Binary file not shown.
Binary file added auth_signup/i18n/._de.po
Binary file not shown.
Binary file added auth_signup/i18n/._en_GB.po
Binary file not shown.
Binary file added auth_signup/i18n/._es.po
Binary file not shown.
Binary file added auth_signup/i18n/._fr.po
Binary file not shown.
Binary file added auth_signup/i18n/._hr.po
Binary file not shown.
Binary file added auth_signup/i18n/._hu.po
Binary file not shown.
Binary file added auth_signup/i18n/._it.po
Binary file not shown.
Binary file added auth_signup/i18n/._mk.po
Binary file not shown.
Binary file added auth_signup/i18n/._mn.po
Binary file not shown.
Binary file added auth_signup/i18n/._nb.po
Binary file not shown.
Binary file added auth_signup/i18n/._nl.po
Binary file not shown.
Binary file added auth_signup/i18n/._pl.po
Binary file not shown.
Binary file added auth_signup/i18n/._pt.po
Binary file not shown.
Binary file added auth_signup/i18n/._pt_BR.po
Binary file not shown.
Binary file added auth_signup/i18n/._ro.po
Binary file not shown.
Binary file added auth_signup/i18n/._ru.po
Binary file not shown.
Binary file added auth_signup/i18n/._sl.po
Binary file not shown.
Binary file added auth_signup/i18n/._tr.po
Binary file not shown.
Binary file added auth_signup/i18n/._zh_CN.po
Binary file not shown.
Loading