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
    Supply Chain
    • 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
    • Kecerdasan Buatan
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • 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
    • Manajemen Properti
    • 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
    • Konsultasi
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
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

Get customer(partner_id.name) against a order_id

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
inheritancepython2.7odoo
1 Balas
8833 Tampilan
Avatar
FalconITSol, Hassan Ali

I had inherited a pos.order But i am unable to add customer of current order in it .if anyone know that how i can fetch the Customer by using the order id.I am beginner in odoo and python . But i tried to understand the pos.order class  but i am not successful in it .  

class pos_order (models.Model):

    _inherit = 'pos.order'



    @ api.multi

    def print_pos_report (self):

     return self.env ['report']. get_action (self, 'point_of_sale.pos_invoice_report')




    @ api.multi

    def print_pos_receipt (self):

        output = []

        discount = 0

        order_id = self.search ([('id', '=', self.id)], limit = 1)

        orderlines = self.env ['pos.order.line']. search ([('order_id', '=', order_id.id)])

        payments = self.env ['account.bank.statement.line']. search ([('pos_statement_id', '=', order_id.id)])

        paymentlines = []

        subtotal = 0

        tax = 0

        change = 0

        for payment in payments:

            if payment.amount> 0:

                temp = {

                    'amount': payment.amount,

                    'name': payment.journal_id.name

                }

                paymentlines.append (temp)

            else:

                change + = payment.amount

             

        for orderline in orderlines:

            new_vals = {

                'product_id': orderline.product_id.name,

                'qty': orderline.qty,

                'price_unit': orderline.price_unit,

                'discount': orderline.discount,

                }

                

            discount + = (orderline.price_unit * orderline.qty * orderline.discount) / 100

            subtotal + = orderline.price_subtotal

            tax + = (orderline.price_subtotal_incl - orderline.price_subtotal)

            

            output.append (new_vals)


        return [output, discount, paymentlines, change, subtotal, tax]

0
Avatar
Buang
Avatar
Jerome Guerriat
Jawaban Terbai

Well, since you inherit pos_order, you have access to all fields of pos_order...

So if you want the current partner_id, just use "self.partner_id" (beware not to have multiple records in self...)


By the way, i did not look through your whole code but even in the beginning there are big mistakes ;)


order_id = self.search ([('id', '=', self.id)], limit = 1)

==> why do you do this? If you use "self.id" in the search function, you are searching "yourself"...

you can use order_id = self, or even more easier, user 'self' in place of order_id


orderlines = self.env ['pos.order.line']. search ([('order_id', '=', order_id.id)])

==> again, you do not need to search to achieve this, since you can directly link the lines from "self"

orderlines = self.lines

1
Avatar
Buang
FalconITSol, Hassan Ali
Penulis

I am a totally beginner with python and odoo . So i am trying to learn it with quick examples. Thanks for your time . can you suggest me some strong reference which relates to my task(I want reprint the orders at pos session i had successful in listing orders and printing single order now i want to access customer of the order)

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
how to do for many2one domain filter?
python2.7 odoo
Avatar
5
Sep 20
9790
How to add a list of product in a view?
python2.7 odoo
Avatar
Avatar
1
Okt 19
7925
how to customize one2many field in odoo
python2.7 odoo
Avatar
0
Feb 19
8167
Domain in xml odoo 10
python2.7 odoo
Avatar
Avatar
2
Nov 18
8259
How to modify “return ” to add a tax line in invoice
python2.7 odoo
Avatar
0
Mei 18
4515
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
  • Karir
  • 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah software terintegrasi dengan 70+ aplikasi seperti CRM, Akuntansi, Inventaris, Sales, eCommerce, Marketing, POS; plus fitur lokal Indonesia!

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