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
    • Diskusi
    • 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

Inhereting Sales Order form view in custom model

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
2 Replies
5725 Tampilan
Avatar
Kai Brossmann

I have some strange behavior when I inherit the sales order form view into my model/view.

I inherited the view into my model without changing the original view.

---

<record id="work_order_form" model="ir.ui.view">
        <field name="name">Extend the Sale Order</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="mode">primary</field>
        <field name="arch" type="xml">

            <field name="payment_term_id" position="after">
                <field name='my_field'/>
            </field>

        </field>
    </record>

---

Therefore I used the primary field (see my code) and I get what I want. Well...

My new view shows the extended field (my_field) and the sales order form view does not, as it should.


Within the sales module so, if I open a quotation, I can see that the quotation form also have the additional field (my_field). But if I am correct both (sales order & quotations use the same view i.e. sale.order.form)


For some reason quotations now also use the extended view.

Some of the code for completeness:

---

To open the view I added:

 <!-- Action to open the Workorder list -->
    <act_window id="action_yacht_service" name="Workorders"
                res_model="sale.order" view_mode="tree,form"/>

    <!-- Menu item to open the Workorder list -->
    <menuitem id="menu_yacht_service" name="Workorder"
              parent="menu_yachtservice" action="action_yacht_service" sequence="2"/>

---

code to inherit the model:

from odoo import fields, models


class YachtService(models.Model):
    _name = 'yacht.service'
    _description = 'Workorder Data'

    name = fields.Char(string="Name")
    description = fields.Text(string="Description")
    cost = fields.Float(string="Cost")



class WorkorderInheritSale(models.Model):
    _inherit = 'sale.order'

   my_field = fields.Boolean(string="Is Workorder")
   my_field_2 = fields.Boolean(string="Is Platzhalter 2")

Really confusing, pls help.


0
Avatar
Buang
Avatar
Falguni Tank
Jawaban Terbai

hello Kai Brossmann,
you need to give  proper xpath for inheriting base view of sale order and give the right external id (including right base module)

Hope this clarify your query..

0
Avatar
Buang
Kai Brossmann
Penulis

Thank you for your answer, is there any way to achieve this without xpath? I tried also a different attempt (see my 2nd post) but that seems to be a different issue altogether.

Avatar
Kai Brossmann
Penulis Jawaban Terbai

I think, I still haven't gotten my head around the view inheritance. I did more research and from what I can read inheritance delegation is used for what I have in mind. I.e. to create a new model based on an existing one, use the features it already has but also add some additional ones.  We use customized Workorders for our repairs but also the standard sales orders for retail etc.

So I tried _inherits and it looked very promising in the beginning.

class YachtService(models.Model):
    _name = 'yacht.service'
    _description = 'Workorder Data'
    _inherits = {'sale.order': 'partner_id'}
    partner_id = fields.Many2one(
        'sale.order',
        ondelete='cascade', required='false', string='Customer')

    my_field_2 = fields.Boolean(string="Is MyField 2")

My view looks like this:

<record id="work_order_form" model="ir.ui.view">
        <field name="name">workorder.form</field>
        <field name="model">yacht.service</field>
        <field name="inherit_id" ref="sale.view_order_form"/> 
        <field name="arch" type="xml">

            <field name="payment_term_id" position="after">
                <field name='my_field_2'/>
            </field>
        </field>
    </record>

Now when starting the model the form appears just like I want it to. The original sale.order.form is not modified, just like it should, sweet....

But the moment I enter data into the customer field (partner_id) I get the following error.

Error:
Odoo Server Error

Traceback (most recent call last):
>
>
>
    raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field 'customer' in leaf "<osv.ExtendedLeaf: ('customer', '=', True) on sale_order (ctx: )>"

I seem so close but now I have now idea where to pick up the tread..



0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

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

Daftar
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