Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • 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 Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and 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
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

[10.0] adding field of child.ids in sale.view_order_form

Odoberať

Get notified when there's activity on this post

This question has been flagged
viewsfieldsformcustomchild_ids
4 Replies
9714 Zobrazenia
Avatar
Ayman Gabr

Hi

i have a custom module for the sale.order.form , what i need is to add the child.ids of the selected partner.id as drop down list.

at below what i write, so please check and feed me back if that right or not?

in the .py

partner_id.child_ids = fields.Many2one('res.partner', string='Contact Person', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
domain=[('partner_id.child_ids', '=', False)])


in the view.xml

<data>
    <xpath expr="//field[@name='partner_id']" position="after">
<field name="partner_id.child_ids" domain="[('customer','=',True)]" context="{'search_default_customer':1}" options='{"always_reload": True}'/>
    </xpath>
</data>


report_templates.xml

<span t-field="doc.partner_id.child_ids"/>



0
Avatar
Zrušiť
Mohammed Amal N

Try this domain : domain=lambda self: [('model_id', '=', self.parent_id.id)]

Avatar
Ayman Gabr
Autor Best Answer

Dear All,

i tried your solutions, but it gives me an error related to another field in the view.xml file , actually i don't know why because I'm not a developer.

now, i will trying another solution as following and i will feed you back.


in report_templates.xml

<t t-if="doc.partner_id.child_ids">
    <t t-if="doc.partner_id.child_ids.type == 'Contact'">
        <span t-field="doc.partner_id.child_ids.name"/>
    </t>
</t>

this solution required to set only one child_ids as contact in the types


appreciate your cooperation


0
Avatar
Zrušiť
Avatar
Asmita Chavan
Best Answer

Remove domain from .py file,

and modify domain in .xml file as,

domain="[('customer', '=', True),('parent_id', '=', partner_id)]"

0
Avatar
Zrušiť
Avatar
Avinash Nk
Best Answer
Hi Ayman Gabr,
 
Change this code.
 
Python:
 partner_id_child_ids = fields.Many2one('res.partner', string='Contact Person', domain=[('parent_id', '=', self.partner_id)])
Xml:
 
 <xpath expr="//field[@name='partner_id']" position="after">
<field name="partner_id_child_ids" domain="[('customer','=',True)]" context="{'search_default_customer':1}" options='{"always_reload": True}'/>
 </xpath>
 
Thank you.
0
Avatar
Zrušiť
Julian Dumitrascu

Where are there such files?
I'm using Odoo (Studio) online and have seen no buttons for editing code.

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Add customer_rank and supplier_rank to partner form
views fields custom
Avatar
Avatar
2
mar 22
7583
Adding a new field in a modules settings menu
views fields custom
Avatar
1
nov 19
8194
How to align checkboxes, in a single line in form? Solved
views fields form V17
Avatar
Avatar
Avatar
2
júl 24
2710
Change the form view used by a relational field
views fields form relational
Avatar
0
mar 15
5715
How to prevent Odoo automatically transform to default form view
action views form custom odooV13
Avatar
Avatar
2
jún 20
3985
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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