Skip to content
Snippets Groups Projects
Commit 79fd51b2 authored by Akash Bhavsar's avatar Akash Bhavsar Committed by Yannick Tivisse
Browse files

[IMP] base_setup: Improve the `General Settings` form view

parent 80c46ee4
No related branches found
No related tags found
No related merge requests found
Showing
with 275 additions and 322 deletions
......@@ -7,4 +7,4 @@ from odoo import fields, models
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
ldaps = fields.One2many(related='company_id.ldaps', string="LDAP Parameters *")
ldaps = fields.One2many(related='company_id.ldaps', string="LDAP Parameters")
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_general_configuration_form_inherit_auth_ldap" model="ir.ui.view">
<record id="base_config_settings_view_form_inherit_auth_ldap" model="ir.ui.view">
<field name="name">base.config.settings.form.inherit.auth.ldap</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="inherit_id" ref="base_setup.base_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='google_analytics']" position="after">
<group string="LDAP Parameters">
<label for="ldaps"/>
<div class="row">
<div class="col-xs-6">
<field name="ldaps">
<form string="LDAP Configuration">
<group col="4">
<field name="ldap_server"/>
<field name="ldap_server_port"/>
<field name="ldap_binddn"/>
<field name="ldap_password" password="True"/>
<field name="ldap_base"/>
<field name="ldap_filter"/>
<field name="create_user"/>
<field name="user"/>
<newline/>
<field name="sequence"/>
<field name="ldap_tls"/>
</group>
</form>
<tree string="LDAP Configuration">
<field name="sequence"/>
<field name="ldap_server"/>
<field name="ldap_server_port"/>
<field name="ldap_base"/>
</tree>
</field>
</div>
</div>
</group>
</xpath>
<div name='auth_ldap_right_pane' position="inside">
<div>
<button type="action" name="%(auth_ldap.action_ldap_installer)d" string="LDAP Server" icon="fa-arrow-right" class="btn-link"/>
</div>
</div>
<div id="auth_ldap_warning" position="replace"/>
</field>
</record>
</odoo>
......@@ -33,14 +33,25 @@
</field>
</record>
<record id="res_company_ldap_view_tree" model="ir.ui.view">
<field name="name">res.company.ldap.tree</field>
<field name="model">res.company.ldap</field>
<field name="arch" type="xml">
<tree string="LDAP Configuration">
<field name="company"/>
<field name="ldap_server"/>
<field name="ldap_server_port"/>
</tree>
</field>
</record>
<!-- ldap installer action -->
<record id="action_ldap_installer" model="ir.actions.act_window">
<field name="name">Setup your LDAP Server</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.company.ldap</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_ldap_installer_form"/>
<field name="view_mode">tree,form</field>
</record>
</odoo>
......@@ -23,7 +23,6 @@ class BaseConfigSettings(models.TransientModel):
auth_oauth_google_enabled = fields.Boolean(string='Allow users to sign in with Google')
auth_oauth_google_client_id = fields.Char(string='Client ID')
server_uri_google = fields.Char(compute='_compute_server_uri', string='Server uri')
auth_oauth_tutorial_enabled = fields.Boolean(string='Show tutorial')
@api.model
def default_get(self, fields):
......
addons/auth_oauth/static/src/img/steps_1.png

5.81 KiB

addons/auth_oauth/static/src/img/steps_2.png

6.32 KiB

addons/auth_oauth/static/src/img/steps_3.png

6.37 KiB

addons/auth_oauth/static/src/img/steps_4.png

5.95 KiB

addons/auth_oauth/static/src/img/steps_5.png

9.79 KiB

addons/auth_oauth/static/src/img/steps_6.png

7.87 KiB

addons/auth_oauth/static/src/img/steps_7.png

9.51 KiB

addons/auth_oauth/static/src/img/steps_8.png

15 KiB

addons/auth_oauth/static/src/img/steps_9.png

8.92 KiB

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_general_configuration" model="ir.ui.view">
<field name="name">base.config.settings.form.inherit</field>
<record id="base_config_settings_view_form_inherit_auth_oauth" model="ir.ui.view">
<field name="name">base.config.settings.form.inherit.oauth</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="inherit_id" ref="base_setup.base_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='google']/label" position="before">
<label for="id" string="Authentication" attrs="{'invisible':[('module_auth_oauth','=',False)]}"/>
<div attrs="{'invisible':[('module_auth_oauth','=',False)]}">
<div name="google" id="top">
<div>
<div id="msg_module_auth_oauth" position="replace">
<div class="content-group">
<div class="mt16">
<button type="action" name="%(auth_oauth.action_oauth_provider)d" string="OAuth Providers" icon="fa-arrow-right" class="btn-link"/>
</div>
</div>
</div>
<div id="module_auth_oauth" position="after">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="auth_oauth_google_enabled"/>
<label for="auth_oauth_google_enabled" string="Allow users to sign in with Google"/>
</div>
<div attrs="{'invisible':[('auth_oauth_google_enabled','=',False)]}">
<div>
<label for="auth_oauth_tutorial_enabled" string="Show Tutorial"/>
<field name="auth_oauth_tutorial_enabled"/>
</div>
<div attrs="{'invisible':[('auth_oauth_tutorial_enabled','=',False)]}">
<h2>
To setup the sign in process with Google, you have to perform
the following steps first.
</h2>
<ol>
<li>
Connect to your Google account and go to
<a href="https://console.developers.google.com/">
https://console.developers.google.com/</a>
</li>
<li>
Click on <b>Create Project</b> and enter the project name and
other details.
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_1.png'/>
</div>
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_2.png'/>
</div>
</li>
<li>
Click on <b>Use Google APIs</b>
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_3.png'/>
</div>
</li>
<li>
On the left side menu, select the sub menu <b>Credentials</b>
(from <b>API Manager</b>) then select <b>OAuth consent screen</b>.
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_4.png'/>
</div>
</li>
<li>
Fill in your address, email and the product name (for example odoo)
and then save.
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_5.png'/>
</div>
</li>
<li>
Then click on <b>Add Credentials</b> and select the second option
(OAuth 2.0 Client ID).
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_6.png'/>
</div>
<div class="mb8">
<img class="mt8" src='/auth_oauth/static/src/img/steps_7.png'/>
</div>
</li>
<li>
Check that the application type is set on <b>Web Application</b>.
Now configure the allowed pages on which you will be redirected.
</li>
<li>
To achieve this, complete the field <b>Authorized redirect URIs</b>.
Copy paste the following link in the box<b>:
<field name="server_uri_google"/></b>
<div class="clearfix"></div>Then click on <b>Create</b>.
<div class="mb8">
<img class="mt8" src='/auth_oauth/static/src/img/steps_8.png'/>
</div>
</li>
<li>
Once done, you receive two information (your <b>Client ID</b> and <b>
Client Secret</b>). You have to insert your <b>Client ID</b> in
the field below.
<div class="mb8">
<img src='/auth_oauth/static/src/img/steps_9.png'/>
</div>
</li>
<div>
<a onclick="document.getElementById('top').scrollIntoView();">
Return to Top</a>
</div>
</ol>
<div class="o_setting_right_pane">
<label string="Google Authentification" for="auth_oauth_google_enabled"/>
<div class="text-muted">
Allow users to sign in with their Google account
</div>
<div class="o_row">
<label for="auth_oauth_google_client_id" string="Google Client ID:"/>
<field name="auth_oauth_google_client_id" placeholder="e.g. 1234-xyz.apps.googleusercontent.com"/>
<div class="content-group" attrs="{'invisible': [('auth_oauth_google_enabled','=',False)]}">
<div class="row mt16">
<label for="auth_oauth_google_client_id" string="Client ID:" class="col-md-3 o_light_label"/>
<field name="auth_oauth_google_client_id" placeholder="e.g. 1234-xyz.apps.googleusercontent.com"/>
</div>
<a href="https://www.odoo.com/documentation/user/online/general/auth/google.html" target="_blank" class="oe_link"><i class="fa fa-fw fa-arrow-right"/>Tutorial</a>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
......@@ -7,8 +7,8 @@ from odoo.tools.safe_eval import safe_eval
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
auth_signup_reset_password = fields.Boolean(string='Enable password reset from Login page', help="This allows users to trigger a password reset from the Login page.")
auth_signup_uninvited = fields.Boolean(string='Allow external users to sign up', help="If unchecked, only invited users may sign up.")
auth_signup_reset_password = fields.Boolean(string='Enable password reset from Login page')
auth_signup_uninvited = fields.Boolean(string='Allow external users to sign up')
auth_signup_template_user_id = fields.Many2one('res.users', string='Template user for new users created through signup')
@api.model
......@@ -20,7 +20,6 @@ class BaseConfigSettings(models.TransientModel):
'auth_signup_uninvited': safe_eval(get_param('auth_signup.allow_uninvited', 'False')),
'auth_signup_template_user_id': safe_eval(get_param('auth_signup.template_user_id', 'False')),
}
@api.multi
def set_auth_signup_template_user_id(self):
self.ensure_one()
......@@ -29,3 +28,10 @@ class BaseConfigSettings(models.TransientModel):
set_param('auth_signup.reset_password', repr(self.auth_signup_reset_password))
set_param('auth_signup.allow_uninvited', repr(self.auth_signup_uninvited))
set_param('auth_signup.template_user_id', repr(self.auth_signup_template_user_id.id))
@api.multi
def open_template_user(self):
action = self.env.ref('base.action_res_users').read()[0]
action['res_id'] = self.env.ref('auth_signup.default_template_user').id
action['views'] = [[self.env.ref('base.view_users_form').id, 'form']]
return action
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_general_configuration" model="ir.ui.view">
<field name="name">base.config.settings.inherit.signup</field>
<record id="base_config_settings_view_form_inherit_auth_signup" model="ir.ui.view">
<field name="name">base.config.settings.inherit.auth.signup</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="inherit_id" ref="base_setup.base_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='module_portal']/.." position="after">
<div>
<field name="auth_signup_reset_password" class="oe_inline"/>
<label for="auth_signup_reset_password"/>
<xpath expr="//div[@id='access_rights']" position="after">
<div class="col-xs-12 col-md-6 o_setting_box" title="If unchecked, only invited users may sign up.">
<div class="o_setting_left_pane">
<field name="auth_signup_uninvited"/>
</div>
<div class="o_setting_right_pane">
<label string="User Signup" for="auth_signup_uninvited"/>
<div class="text-muted">
Allow external users to sign up from Login page
</div>
<div class="content-group" attrs="{'invisible': [('auth_signup_uninvited','=',False)]}">
<div class="mt16">
<button type="object" name="open_template_user" string="Default Access Rights" icon="fa-arrow-right" class="btn-link"/>
</div>
</div>
</div>
</div>
<div>
<field name="auth_signup_uninvited" class="oe_inline"/>
<label for="auth_signup_uninvited"/>
</div>
<div attrs="{'invisible':[('auth_signup_uninvited','=',False)]}" groups="base.group_no_one">
<label for="auth_signup_template_user_id"/>
<field name="auth_signup_template_user_id" class="oe_inline"
attrs="{'required': [('auth_signup_uninvited', '=', True)]}"
domain="['|',('active','=',0),('active','=',1)]"/>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="auth_signup_reset_password"/>
</div>
<div class="o_setting_right_pane">
<label string="Password Reset" for="auth_signup_reset_password"/>
<div class="text-muted">
Enable password reset from Login page
</div>
</div>
</div>
</xpath>
</field>
......
......@@ -3,4 +3,4 @@
import ir_translation
import res_company
import res_config
\ No newline at end of file
import res_config
......@@ -3,44 +3,43 @@
<record id="view_general_configuration_form_inherit_base_gengo" model="ir.ui.view">
<field name="name">base.config.settings.form.inherit.base.gengo</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="inherit_id" ref="base_setup.base_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='google_analytics']" position="after">
<group string="Gengo Translator" name="gengo">
<label for="id" string="Public Key*"/>
<xpath expr="//div[@name='base_gengo_right_pane']" position="inside">
<div name="base_gengo_right_pane" position="replace">
<label for="id" string="Public Key"/>
<div name="gengo_public_key">
<div name="gengo_public_key">
<field name="gengo_public_key" nolabel="1" placeholder="Add Gengo login Public Key..."/>
</div>
</div>
<label for="id" string="Private Key*"/>
<label for="id" string="Private Key"/>
<div name="gengo_private_key">
<div name="gengo_private_key">
<field name="gengo_private_key" password="True" nolabel="1" placeholder="Add Gengo login Private Key..."/>
</div>
</div>
<label for="id" string="Auto Approve Translation*"/>
<div name="gengo_auto_approve">
<div name="gengo_auto_approve">
<field name="gengo_auto_approve"/>
<label for="gengo_auto_approve"/>
<label for="id" string="Auto Approve Translation"/>
</div>
</div>
<label for="id" string="Sandbox Mode*"/>
<div name="gengo_sandbox">
<div name="gengo_sandbox">
<field name="gengo_sandbox"/>
<label for="gengo_sandbox"/>
<label for="id" string="Sandbox Mode"/>
</div>
</div>
<label for="id" string="Comment*"/>
<label for="id" string="Comment"/>
<div name="gengo_comment">
<div name="gengo_comment">
<field name="gengo_comment" nolabel="1" placeholder="Add your comments here for translator...."/>
</div>
</div>
</group>
</div>
</xpath>
<xpath expr="//div[@name='base_gengo_warning']" position="replace"/>
</field>
</record>
</odoo>
</odoo>
\ No newline at end of file
......@@ -8,42 +8,31 @@ class BaseConfigSettings(models.TransientModel):
_name = 'base.config.settings'
_inherit = 'res.config.settings'
group_multi_company = fields.Boolean(string='Manage multiple companies',
help='Work in multi-company environments, with appropriate security access between companies.',
implied_group='base.group_multi_company')
group_multi_company = fields.Boolean("Manage multiple companies", implied_group='base.group_multi_company')
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: self.env.user.company_id)
module_share = fields.Boolean(string='Allow documents sharing',
help="""Share or embed any screen of Odoo.""")
module_portal = fields.Boolean(string='Activate the customer portal',
help="""Give your customers access to their documents.""")
module_auth_oauth = fields.Boolean(string='Use external authentication providers (OAuth)')
module_base_import = fields.Boolean(string="Allow users to import data from CSV/XLS/XLSX/ODS files")
module_google_drive = fields.Boolean(string='Attach Google documents to any record',
help="""This installs the module google_docs.""")
default_user_rights = fields.Boolean("Default Access Rights", default_model='base.config.settings')
default_external_email_server = fields.Boolean("External Email Servers", default_model='base.config.settings')
module_base_import = fields.Boolean("Allow users to import data from CSV/XLS/XLSX/ODS files")
module_pad = fields.Boolean("External Pads")
module_google_calendar = fields.Boolean(
string='Allow the users to synchronize their calendar with Google Calendar',
help="""This installs the module google_calendar.""")
module_inter_company_rules = fields.Boolean(string='Manage Inter Company',
help="""This installs the module inter_company_rules.\n Configure company rules to automatically create SO/PO when one of your company sells/buys to another of your company.""")
string='Allow the users to synchronize their calendar with Google Calendar')
module_google_drive = fields.Boolean("Attach Google documents to any record")
module_google_spreadsheet = fields.Boolean("Google Spreadsheet")
module_auth_oauth = fields.Boolean("Use external authentication providers (OAuth)")
module_auth_ldap = fields.Boolean("LDAP Authentification")
module_base_gengo = fields.Boolean("Translate Your Website with Gengo")
module_inter_company_rules = fields.Boolean("Manage Inter Company")
company_share_partner = fields.Boolean(string='Share partners to all companies',
help="Share your partners to all companies defined in your instance.\n"
" * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
" * Unchecked : Each company can see only its partner (partners where company is defined). Partners not related to a company are visible for all companies.")
default_custom_report_footer = fields.Boolean("Custom Report Footer", default_model='base.config.settings')
rml_footer = fields.Text(related="company_id.rml_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.")
group_multi_currency = fields.Boolean(string='Allow multi currencies',
implied_group='base.group_multi_currency',
help="Allows to work in a multi currency environment")
# Report config from base/res/res_company.py
custom_footer = fields.Selection(related="company_id.custom_footer")
rml_footer = fields.Text(related="company_id.rml_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.")
rml_paper_format = fields.Selection(related="company_id.rml_paper_format", string="Paper Format *", required=True)
font = fields.Many2one(related='company_id.font', string="Font *", help="Set the font into the report header, it will be used as default font in the RML reports of the user company")
rml_header = fields.Text(related="company_id.rml_header", string="RML Header *")
rml_header2 = fields.Text(related="company_id.rml_header2", string='RML Internal Header *')
rml_header3 = fields.Text(related="company_id.rml_header3", string='RML Internal Header for Landscape Reports *')
@api.multi
def open_company(self):
return {
......@@ -55,11 +44,9 @@ class BaseConfigSettings(models.TransientModel):
'res_id': self.env.user.company_id.id,
'target': 'current',
}
@api.multi
def open_default_user(self):
action = self.env.ref('base.action_res_users').read()[0]
action['context'] = self.env.context
action['res_id'] = self.env.ref('base.default_user').id
action['views'] = [[self.env.ref('base.view_users_form').id, 'form']]
return action
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment