Skip to Content
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
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • 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

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
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

How to create a new field have 2 related field by developer mode

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
development
2 Odpowiedzi
573 Widoki
Awatar
pham-ngoc-huy.hoang@otech.com.vn

I created a new field called Booking Number on the Receipt form.

This field is related to the Booking Number of the Purchase Order through the related field: purchase_id.x_booking_number.

After that, I wanted to create another Booking Number field on the Delivery Order form to link it with the Booking Number of the Sale Order.

However, I discovered that the Receipt and Delivery Order share the same view in Odoo.

I don’t want to have two separate Booking Number fields on this shared interface.

Is there a way to make the same Booking Number field dynamically receive the value from either the Purchase Order or the Sale Order, depending on the type of transfer?

0
Awatar
Odrzuć
Codesphere Tech

Hello,
Yes, you can refer Operation Type field on the same model..

Chris TRINGHAM

You should be able to use computed fields for this: https://odootricks.tips/computed-fields/

Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

Hi,


In Odoo, both the Receipt and Delivery Order share the same model (stock.picking) and view, so instead of creating two separate fields, you can use a single dynamic field. The best solution is to define one field called Booking Number (x_booking_number) on the stock.picking model and make it a computed and stored field. This field automatically fetches its value based on the type of transfer, from the Purchase Order for receipts and from the Sale Order for deliveries.


class StockPicking(models.Model):

    _inherit = 'stock.picking'


    x_booking_number = fields.Char(

        string="Booking Number",

        compute='_compute_booking_number',

        store=True

    )


    @api.depends('purchase_id.x_booking_number', 'sale_id.x_booking_number', 'picking_type_code')

    def _compute_booking_number(self):

        for picking in self:

            if picking.picking_type_code == 'incoming' and picking.purchase_id:

                # Receipt – get from Purchase Order

                picking.x_booking_number = picking.purchase_id.x_booking_number

            elif picking.picking_type_code == 'outgoing' and picking.sale_id:

                # Delivery Order – get from Sale Order

                picking.x_booking_number = picking.sale_id.x_booking_number

            else:

                picking.x_booking_number = False


The logic relies on the picking_type_code field, which identifies whether a transfer is incoming, outgoing, or internal. The compute method checks this field and assigns the corresponding booking number accordingly. This way, the same field dynamically updates depending on the transfer type.


In the view, you only need to display a single <field name="x_booking_number"/>, and Odoo will automatically show the correct booking number. This approach keeps your form clean, avoids duplication, and ensures the right data appears for each operation type.


Hope it helps

1
Awatar
Odrzuć
Awatar
pham-ngoc-huy.hoang@otech.com.vn
Autor Najlepsza odpowiedź

can i try it by develovper mode or odoo studio, I am using the Odoo online version so I can't code

0
Awatar
Odrzuć
Codesphere Tech

If you have installed the studio app then try to edit the action view.. I've not much knowledge about the studio customization.

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 make all branches for user active automatically after login his account?
development
Awatar
Awatar
Awatar
3
lis 25
309
MrpBom _skip_bom_line skips line of product that has two multi-choice attribute values when both are selected in Apply to variant
development
Awatar
Awatar
1
lis 25
243
i face one error while edit my website
development
Awatar
0
paź 25
664
How to add market price of the product to the Odoo 18 Community POS receipt?
development
Awatar
0
paź 25
592
Unable to create views in my custom module or an application Rozwiązane
development
Awatar
Awatar
2
paź 25
6785
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 ภาษาไทย 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