Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Why is my many2one field not displayed the same way at this two places?

Odebírat

Get notified when there's activity on this post

This question has been flagged
addressformviewmany2one
5 Odpovědi
6622 Zobrazení
Avatar
Pascal Tremblay

Hello all,

We are on Odoo 10.

I have declared a new many2one field customer_of_division_id in the model sale.order and in the model account.invoice.

I have added the field on the form view of both models this way :

<field name="customer_of_division_id"/>


My field is displayed like this in a new sale order :



And my field is displayed like this on a new invoice :



Why is it not the same on both? How to avoid all the address displayed on the second one?


EDIT #1 : Here is all the code

In the Python

class SaleOrder(models.Model):
_inherit = "sale.order"
    customer_of_division_id = fields.Many2one(related="partner_id.customer_of_division_id", string='Customer of the division')

class AccountInvoice(models.Model):
_inherit = "account.invoice"
    customer_of_division_id = fields.Many2one(related="partner_id.customer_of_division_id", string='Customer of the division', readonly=True)

In the XML

<record id="invoice_form" model="ir.ui.view">
    <field name="name">account.invoice.form.inherit.vtm2</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form" />
    <field name="arch" type="xml">
        <xpath expr="//field[@name='partner_shipping_id']" position="attributes">
            <attribute name="domain">['&amp;',('parent_id','=',partner_id),('type','=','delivery')]</attribute>
        </xpath>
        <field name="payment_term_id" position="after">
            <field name="customer_of_division_id"/>
        </field>
     </field>
</record>
<record id="view_order_form" model="ir.ui.view">
    <field name="name">sale.view.order.form.inherit.vtm2</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form" />
    <field name="arch" type="xml">
        <xpath expr="//field[@name='partner_shipping_id']" position="attributes">
            <attribute name="domain">['&amp;',('parent_id','=',partner_id),('type','=','delivery')]</attribute>
        </xpath>
         <field name="payment_term_id" position="after">
             <field name="customer_of_division_id" attrs="{'readonly': [('state', 'not in', ('draft','sent'))]}"/>
         </field>
    </field>
</record>

0
Avatar
Zrušit
Akhil P Sivan

Hi, can you paste the code of your field definition and also xml inheritance code? How you pass value to the Many2one field on invoice?

Pascal Tremblay
Autor

If I remove the 'Readonly=True' in my Python declaration, It is well displayed. Thanks. But it doesn't help me to understand why all the address was displayed..???!!! Big thanks

Akhil P Sivan

Sorry. I thought that it was an easy problem. I have put my code above. Thanks.

Avatar
Akhil P Sivan
Nejlepší odpověď

For me it shows just partner without address after saving the invoice record. Can u just try without readonly=True.

I am not sure about that behaviour in readonly mode.

1
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Form view aligned to the left side Vyřešeno
form view
Avatar
Avatar
1
lis 25
2587
How to create many2one field ??
form many2one
Avatar
Avatar
Avatar
Avatar
4
čvc 23
2963
OpenERP 7: hide Form Header for read only purpose Vyřešeno
form view
Avatar
Avatar
1
zář 21
10317
"many2many_tags" show a refrence of the tag not the name !! Vyřešeno
form view
Avatar
Avatar
1
led 24
17898
How to write this domain for a one2many field on a view? Vyřešeno
domain form view many2one one2many
Avatar
Avatar
3
úno 17
27327
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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