Przejdź do zawartości
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Sztuczna inteligencja
    • IoT
    • VoIP
    • Wiedza
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Get customer(partner_id.name) against a order_id

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
inheritancepython2.7odoo
1 Odpowiedz
8836 Widoki
Awatar
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
Awatar
Odrzuć
Awatar
Jerome Guerriat
Najlepsza odpowiedź

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
Awatar
Odrzuć
FalconITSol, Hassan Ali
Autor

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)

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
how to do for many2one domain filter?
python2.7 odoo
Awatar
5
wrz 20
9791
How to add a list of product in a view?
python2.7 odoo
Awatar
Awatar
1
paź 19
7927
how to customize one2many field in odoo
python2.7 odoo
Awatar
0
lut 19
8170
Domain in xml odoo 10
python2.7 odoo
Awatar
Awatar
2
lis 18
8261
How to modify “return ” to add a tax line in invoice
python2.7 odoo
Awatar
0
maj 18
4522
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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