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

display list of product based on domain

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
domaindomain_filterOdoo13.0
6 Replies
8408 Tampilan
Avatar
himaOdoo

i want to display only the products that has as a status = 'qualifid' when i am creating a new sales order in the sales.order.lines form 

for this i added the new selection field in the product.template model 

_inherit = "product.template"

    state = fields.Selection([
        ('scratch', 'Brouillion'),
        ('qualifid', 'Qualifié'),
        ('valide', 'Validé'),
        ], setting='State', readonly=True, default='scratch')

i added the field to the correspanding view 

<record id="view_product_template_tech_inherit" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="/form/header/button" position="after">
<field name="state" widget="statusbar"/>
</xpath>
</field>
</record>

and then i try to set the product_id in with this domaine 

<record id="view_sale_order_tech_inherit" model="ir.ui.view">
<field name="name">tech.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath
expr="//page[@name='order_lines']/field/form/group/group/field[@name='product_id']" position="replace">
<field name="product_id" domain="[('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id), ('state', '!=', 'scratch')]"/>
</xpath>
</field>
</record>

but it seems something still missing 

0
Avatar
Buang
Avatar
Vishnu Vanneri
Jawaban Terbai

Hi,

Please try Below Code.

<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="domain">['&amp;',('state', '=', 'scratch'),('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]</attribute>

</xpath>


1
Avatar
Buang
himaOdoo
Penulis

hi, i tried your suggestion and it seems somthing wrong

File "src/lxml/parser.pxi", line 600, in lxml.etree._ParserContext._handleParseResultDoc

File "src/lxml/parser.pxi", line 710, in lxml.etree._handleParseResult

File "src/lxml/parser.pxi", line 639, in lxml.etree._raiseParseError

File "/usr/lib/python3/dist-packages/odoo/addons/tech_sale/views/tech_sale.xml", line 22

lxml.etree.XMLSyntaxError: xmlParseEntityRef: no name, line 22, column 29

Vishnu Vanneri

Sorry forgot to specify '&' to '&amp;' , answer updated , Try it.

himaOdoo
Penulis

yes, the error occured due to a syntax error, thanks, i'll mark it as a best answer

Avatar
Niyas Raphy (Walnut Software Solutions)
Jawaban Terbai

Hi,

If there is no errors in installation of the module, make sure that the given domain for the field is correct, just ensure that the OR statement is placed correctly.


Also checking the code, it seems you are applying domain by xpath the one2many form view, so are you checking from the one2many form itself ? If not apply the same domain in the one2many tree view also, or you can directly apply the domain inheriting the sale.order.line in python file itself.


Sample xpath of sale order line view,

<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="field_name"/>
</xpath>


Thanks

0
Avatar
Buang
himaOdoo
Penulis

i tried to change the order of the domain conditions, by setting the ('state', '!=', 'scratch') first i had this error

odoo.tools.convert.ParseError: "unexpected EOF while parsing

('<unknown>', 1, 123, "('state', '=', 'scratch'), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id), ('sale_ok', '=', True)]")" while parsing /usr/lib/python3/dist-packages/odoo/addons/tech_sale/views/tech_sale.xml:2, near

<odoo>

odoo.tools.convert.ParseError: "unexpected EOF while parsing

('<unknown>', 1, 123, "('state', '=', 'scratch'), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id), ('sale_ok', '=', True)]")" while parsing /usr/lib/python3/dist-packages/odoo/addons/tech_sale/views/tech_sale.xml:2, near

<odoo>

it could be just the syntaxe ?

Niyas Raphy (Walnut Software Solutions)

yes given syntax is wrong

himaOdoo
Penulis

any suggestion please ?

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
Condition Drop Down Items
domain domain_filter
Avatar
0
Feb 25
18
get fields value based on domain
domain Odoo13.0
Avatar
Avatar
1
Okt 20
4034
Construct a "domain=" across many2many fields Diselesaikan
domain domain_filter
Avatar
Avatar
2
Mar 15
7801
Domain filters by followers
domain domain_filter
Avatar
0
Mar 15
4297
How to narrow down the domain of a class based of a selection filed of this class?
domain domain_filter
Avatar
Avatar
1
Mar 15
4492
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