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 bypass company dependent field in M2O Selection

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
multicompanycompany_idcompanydependent
4 Odpowiedzi
6232 Widoki
Awatar
Aadeel S. Puri

Hello Dear Odoers,

I need some help I have created a related field in my model 

location_dest_id = fields.Many2one('stock.location', string='To', domain="[('usage', '=', 'internal')]", required=True)

Currently it shows stock locations from the company assigned to a user, I want to show all records in stock location for user selection.

Please help.

0
Awatar
Odrzuć
Awatar
Aadeel S. Puri
Autor Najlepsza odpowiedź

I have found a solution by changing the field from many2one to selection and computing selection records. with that, I can able to select stock location from other companies as well.

def _location_selection(self):
domain = [('usage', '=', 'internal')]
locations = self.env['stock.location'].sudo().search(domain)
return list(map(lambda location: (str(location.id), ', '.join([location.complete_name, location.company_id.name])), locations))
location_dest_id = fields.Selection(
selection=lambda self: self._location_selection(),
string="To",
help="Destination Stock Location.",
required=True
)


0
Awatar
Odrzuć
Awatar
Adil Akbar
Najlepsza odpowiedź

Hi, 

You can see following for this, it has complete explanation for company_dependent fields alongwith access restriction and python code:

https://youtu.be/GkNgc-fZO-I

Hope it helps,

Thanks

0
Awatar
Odrzuć
Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

Hi,

Add "check_company=False" in your code

location_dest_id = fields.Many2one('stock.location', string='To', domain="[('usage', '=', 'internal')]", required=True, check_company=False)

Regards

0
Awatar
Odrzuć
Aadeel S. Puri
Autor

Hi,
Thanks for your response, I have added check_company=False no difference. user has to select both companies in order to get locations.
I want user to select location from B Company regardless of allowed company to the user.
I am using 13 CE.

Awatar
jjjaberi0n
Najlepsza odpowiedź

Hi, im trying understand your code. Can you tell me what is the purpose of the model that has field 'location_dest_id'?

That model has many-to-one relationship with model 'stock.location', right? So how does this relationship help with your object that is showing all records in stock location?

0
Awatar
Odrzuć
Aadeel S. Puri
Autor

Thanks for your response.
I have built inter warehouse stock transfer module. Which is working flawlessly, but there is a problem. In my case we are working with a multi-company environment.

Suppose
User A assigned to -> Company A
User B assigned to -> Company B
User C assigned to -> Company C

Stock.Location
WH/Stock1 | Company A
WH/Stock2 | Company B
WH/Stock3 | Company C

Now User A has logged in and open the form which contains mainy2one stock.location field
He can able to see in many2one selection WH/Stock1, Until unless I give him all the companies access, and he selects all companies he won't be able to see other locations.

I want him to able to see all locations in that particular many2one field all the available locations regardless of companies he is assigned.

Currently Odoo has a very ridiculous approach in terms of inter companies stock transfer, It didn't have branch management so we are using companies as branches. I have built this module inspired by the Microsoft Dynamics RMS stock transfer mechanism, which is way more easier to work, less prone to user mistakes, and highly flexible on reporting.

Hope you understand my pain :(

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 get current company in xml?
xml company_id companydependent
Awatar
Awatar
5
cze 20
6553
Domain for sale.order.line to show only products that belongs to selected company_id Rozwiązane
sale.order.line sale.order.form multicompany company_id
Awatar
Awatar
1
mar 16
13306
Clarification on Creating Companies and Users in the Odoo Database
multicompany
Awatar
Awatar
Awatar
2
lip 25
3022
Multi Company set up
multicompany
Awatar
Awatar
Awatar
3
lip 25
3519
How many levels of sub-entities does the multicompany functionality of the accounting software support? Rozwiązane
multicompany
Awatar
Awatar
1
lip 25
2610
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