Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

ver.14: how to customize login page

Subscribe

Get notified when there's activity on this post

This question has been flagged
customizeloginpagev14
2 Replies
23903 Views
Avatar
SmithJohn45

how i can customize login page and add a field contact_no (already inherited res.users and added contact_no), when user press [Log in] button, this will authenticate the user using contact_no first if exist otherwise use email.

please help.

screenshot for login page: ( here are only 2 fields email and password )


0
Avatar
Discard
Avatar
Alaa
Best Answer

You can use these apps (search apps in odoo apps by names provided below) to change the whole login page style.

Moreover, these apps provide the ability to define your own favicon and logo as you wish.

Apps Name:

Minimalist Login Form

Creative Login Form

Advanced Login Form


0
Avatar
Discard
Avatar
Yurii Razumovskyi
Best Answer

Hi.

In your case, I think, you could go the following way:

To change the method "_get_login_domain" from the file "odoo/addons/base/models/res_users.py":

    @api.model
    def _get_login_domain(self, login):
        return [('login', '=', login)]

This domain is used in the method "_login" in the same model to get a user by a login. If you inherit the method and change the domain adding your condition like ('contact_no', '=', login) you could get the necessary result. My solution was not tested and may be used as a possible case, so please test it before on your system.


P.S. If you will want to add your parameter to the login page you can do it in the following way:

    <template id="login" inherit_id="web.login" name="Custom Login" >
         <xpath expr="//div[hasclass('field-login')]" position="before">
<div class="form-group field-contact-no">
<label for="contact_no">Contact No</label>
<input type="text" placeholder="Contact No" name="contact_no" t-att-value="contact_no" id="contact_no" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autofocus="autofocus" autocapitalize="off"/>
</div>
</xpath>
    </template>

After that, you also need to add the logic for the "contact_no" parameter to the controller method "web_login" in the "web" module.

0
Avatar
Discard
SmithJohn45
Author

thanks for detailed guide & help, will check it and confirm.

SmithJohn45
Author

first i implemented view part as you have created here, its looking fine Contact No is on top of Email.

to change the method _get_login_domain i failed to find the 'base' folder, may be in odoo 14 it changed. the file res_users.py exist in /addons/base_setup/ but it also inheritting ' res.users ' to modify. i searched for _get_ligin_domain within files, it present in /addons/website/models but it not looks like what you have posted here. please advise.

SmithJohn45
Author

also checked /addons/web/controllers/main.py , web_login method is there but (as per my knowledge as beginner) i failed to figure it out, how to add the logic for the "contact_no" parameter? plesae help.

Yurii Razumovskyi

Hi.

The implementation of the logic that you need is quite complicated and will take time. If you are a beginner and it's your education task I propose to read the book "Odoo Development Essentials" https://www.packtpub.com/product/odoo-development-essentials/9781784392796 or "Odoo 14 Development Cookbook - Fourth Edition" https://www.packtpub.com/product/odoo-14-development-cookbook-fourth-edition/9781800200319.

If it's a business task you could hire our team to solve it by emailing support@garazd.biz.

Best Regards, Yurii Razumovskyi.

Company "Garazd Creation"

https://garazd.biz

SmithJohn45
Author

thanks for books links. regards

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
"Remember Me" Login option in odoo
login loginpage v14
Avatar
0
Mar 21
3688
Blank white page after login.
login page blank
Avatar
0
Jun 16
10416
putting part of the report at the start of the last page odoo14 Solved
reporting page pages v14
Avatar
Avatar
Avatar
2
May 23
3345
How do I create a blank page so I can customize it only in CSS by myself?
style customize page odoo12
Avatar
0
Feb 23
2920
How to call function when page loaded odoo-14
function page loaded v14
Avatar
Avatar
1
Jul 22
6542
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now