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

How to display with selection my users into my form

Subscribe

Get notified when there's activity on this post

This question has been flagged
selectionforeachodoo10
3 Replies
7565 Views
Avatar
Jules

Hello, 

I want to display with selection input, my users database 's table.


This is my template : 

<div class="form-group form-field">
<div class="col-md-3 col-sm-4 text-right">
<label class="control-label" for="x_membre_interne">
Membres de l'équipe ffeeaz
</label>
</div>

<div class="col-md-7 col-sm-8 ">
<select id="membre_interne" name="x_membre_interne"
class="form-control height-select">
<option value="" selected="selected">Sélectionnez...</option>
<t t-foreach="users" t-as="user">
<option value="">
<t t-esc="user.name"/>
</option>
</t>
</select>
</div>
Controller.py: 
""" formulaire pour deposer un appel d'offre """
@http.route('/coopaname_helpdesk/post_form_ticket/<string:model_name>', methods=['POST'], type = 'http', auth='public', website= True, Store=True )
def website_form(self, model_name, **kwargs):

objet_consultation = kwargs.get('x_objet_consultation')
cat = kwargs.get('x_cat')
membre_interne = kwargs.get('x_membre_interne')
membre_externe = kwargs.get('x_membre_externe')
equipeok = kwargs.get('x_equipeok')
admin = kwargs.get('x_admin')
type_marche = kwargs.get('x_type_marche')
ville_adju = kwargs.get('x_ville_adju')
date_order = kwargs.get('x_date_order')
date_limite = kwargs.get('x_date_limite')
duree_marche = kwargs.get('x_duree_marche')
montant_marche = kwargs.get('x_montant_marche')
num_ref = kwargs.get('x_num_ref')
pj = kwargs.get('x_pj')
name = kwargs.get('x_name')
mail = kwargs.get('x_mail')
inputstreet1 = kwargs.get('x_inputstreet1')
inputcity1 = kwargs.get('x_inputcity1')
inputzip1 = kwargs.get('x_inputzip1')
inputstreet2 = kwargs.get('x_inputstreet2')
inputcity2 = kwargs.get('x_inputcity2')
inputzip2 = kwargs.get('x_inputzip2')

data = {
'x_cat' : cat,
'x_objet_consultation' : objet_consultation,
'x_membre_interne' : membre_interne,
'x_membre_externe' : membre_externe,
'x_equipeok' : equipeok,
'x_admin' : admin,
'x_type_marche' : type_marche,
'x_ville_adju':ville_adju,
'x_date_order': date_order,
'x_date_limite': date_limite,
'x_duree_marche': duree_marche,
'x_montant_marche' : montant_marche,
'x_num_ref' : num_ref,
'x_pj' : pj,
'x_name' : name,
'x_mail' : mail,
'x_inputstreet1' : inputstreet1,
'x_inputcity1' : inputcity1,
'x_inputzip1' : inputzip1,
'x_inputstreet2': inputstreet2,
'x_inputzip2' : inputzip2,
'x_inputcity2' : inputcity2
}
users = request.env['res_partner'].sudo().search([])
request.env['monmarchepublic'].create(data)
return http.request.render('/coopaname_helpdesk/succes', {'users' : users})

Should i put my foreach loop inside my value 's input or outside ? 

Thanks for help my friends ! 

1
Avatar
Discard
Sudhir Arya (ERP Harbor Consulting Services)

Thanks my friends you're the best ! 

Sorry but i just started odoo and python language ^^


Sudhir Arya (ERP Harbor Consulting Services)

Not a problem. I am glad that at least you tried something rather than just asking how to do that.

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Your code of  searching the users / partners is wrong.

It should be as follow:

users = request.env['res.users'].sudo().search([])


4
Avatar
Discard
Avatar
Jithin
Best Answer
<div class="col-md-7 col-sm-8 ">
<select id="membre_interne" name="x_membre_interne"
class="form-control height-select">
<option value="" selected="selected">Sélectionnez...</option>
<t t-foreach="users" t-as="user">
<option t-att-value="user.name">
<t t-esc="user.name"/>
</option>
</t>
</select>
</div>


0
Avatar
Discard
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
How to get key value list from selection fields in Odoo 10 Solved
selection odoo10
Avatar
Avatar
Avatar
Avatar
Avatar
5
May 22
26781
Odoo10: How to update the selection column for ir.model.fields table accordingly?
selection odoo10
Avatar
0
Feb 18
5877
[SOLVED] How to create dynamic selection from model data? Solved
selection dynamic odoo10
Avatar
Avatar
2
Sep 23
13716
how to print value, key of dict item in xml ? Solved
xml foreach odoo10
Avatar
Avatar
Avatar
2
Aug 23
13715
Hello, please help me, How to fix "NoneType' object has no attribute '__getitem__'" error
report foreach odoo10
Avatar
0
Jan 18
7026
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