Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to display subfields in a tree view?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
fieldstreeviewtreevalidateerrorodooV8
3 Replies
15468 Tampilan
Avatar
Malte Jörgens

We have a franchise as a customer and as they all are treated as single customers for invoicing, the customer names are pretty similar. In the account.invoice view, we therefore want to add a column containing the city of the customer. So I changed account.invoice.tree to include the partner_id.city field as shown below.

<?xml version="1.0"?>
<tree colors="blue:state == 'draft';black:state in ('proforma','proforma2','open');gray:state == 'cancel'" string="Invoice">
<field name="partner_id" groups="base.group_user"/>
    <field name="partner_id.city"/>
    <field name="commercial_partner_id" invisible="1"/>
    <field name="date_invoice"/>
    <field name="number"/>
    <field name="reference" invisible="1"/>
    <field name="name" invisible="1"/>
    <field name="journal_id" invisible="1"/>
    <field name="period_id" invisible="1" groups="account.group_account_user"/>
    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
    <field name="user_id" string="Responsible"/>
    <field name="date_due"/>
    <field name="origin"/>
    <field name="currency_id" groups="base.group_multi_currency"/>
    <field name="residual" sum="Residual Amount"/>
  <field name="amount_untaxed" sum="Untaxed Amount"/>
  <field name="amount_total" sum="Total Amount"/>
    <field name="state"/>
</tree>

However, upon saving I get this error:

ValidateError
Field(s) `arch` failed against a constraint: Ungültige Ansichtendefinition [Invalid view definition]
Error details:
Das Feld `partner_id.city` existiert nicht [Field does not exist]
Fehler Kontext:
Ansicht `account.invoice.tree`
[view_id: 584, xml_id: account.invoice_tree, model: account.invoice, parent_id: k. A.]

As I have not seen the use of attributes of contained fields, I wonder if this attempt actually works. Can anyone point me in the right direction?

1
Avatar
Buang
Avatar
Zbik
Jawaban Terbai

In new api with models.Model there is not anymore fields.related fields. Try this:


from openerp import models, fields, api

class invoice_city(models.Model):

     _inherit = 'account.invoice'

     city = fields.Char(string='City', related='partner_id.city')

2
Avatar
Buang
Avatar
Michael Pol
Jawaban Terbai

The one of right direction could be to use related field if you have limited fields to be shown from Customer in Invoice. Inherit account.invoice class and put a new filed. For example

'city': fields.related('partner_id', 'city', type='char', string='City' ),

Instead of using 

<field name="partner_id.city"/>

just use

<field name="city"/>

1
Avatar
Buang
Avatar
Malte Jörgens
Penulis Jawaban Terbai

As Micheal Pol suggested, I created a new module inheriting account.invoice. This works very well, until the server is restarted/the module is loaded again (e.g. updating). The server will then return an Internal Server Error (500) with this stacktrace:

[...]

File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 498, in _button_immediate_function registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True) File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 366, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 351, in load_modul es force, status, report, loaded_modules, update_module) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 255, in load_marke d_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_module s=loaded_modules, perform_checks=perform_checks) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 152, in load_modul e_graph models = registry.load(cr, package) File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 162, in load model = cls._build_model(self, cr) File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 592, in _build_model original_module = pool[name]._original_module if name in parents else cls._module File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 101, in __getitem __ return self.models[model_name] KeyError: 'account.invoice'


The module I created looks like this:

 from openerp import models, fields, api 

class invoice_city(models.Model): 
    _inherit = 'account.invoice' 
    city = fields.related('partner_id', 'city', type='char', string='City')

EDIT:
I changed the last line to the new API as zkib suggested, but I still get the above error message upon updating/restarting the module. This is important as the server is restarted every night for maintanence reasons (Backup). I tried this on a fresh Odoo Installation with the same behaviour.

0
Avatar
Buang
Zbik

Your "depends" in __openerp__.py?

Malte Jörgens
Penulis

Oh. Hah. Yeah, that was it. I added 'account' to it and now it works properly. Thank you!

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Odoo 8 tree view only show one record
treeview odooV8
Avatar
1
Okt 16
4652
display field by selected model.
fields odooV8
Avatar
0
Mar 16
4148
Retrieving the keys from the selection field
fields odooV8
Avatar
0
Des 15
5372
how to display data in custom table in a form view (Odoo)
treeview odooV8
Avatar
Avatar
1
Sep 15
11350
Highlight Records in Tree Diselesaikan
treeview tree odoo
Avatar
Avatar
Avatar
Avatar
3
Mei 23
3007
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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