Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to bypass company dependent field in M2O Selection

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
multicompanycompany_idcompanydependent
4 Antwoorden
6241 Weergaven
Avatar
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
Avatar
Annuleer
Avatar
Aadeel S. Puri
Auteur Beste antwoord

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
Avatar
Annuleer
Avatar
Adil Akbar
Beste antwoord

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
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord

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
Avatar
Annuleer
Aadeel S. Puri
Auteur

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.

Avatar
jjjaberi0n
Beste antwoord

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
Avatar
Annuleer
Aadeel S. Puri
Auteur

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 :(

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
How to get current company in xml?
xml company_id companydependent
Avatar
Avatar
5
jun. 20
6558
Domain for sale.order.line to show only products that belongs to selected company_id Opgelost
sale.order.line sale.order.form multicompany company_id
Avatar
Avatar
1
mrt. 16
13307
Clarification on Creating Companies and Users in the Odoo Database
multicompany
Avatar
Avatar
Avatar
2
jul. 25
3028
Multi Company set up
multicompany
Avatar
Avatar
Avatar
3
jul. 25
3525
How many levels of sub-entities does the multicompany functionality of the accounting software support? Opgelost
multicompany
Avatar
Avatar
1
jul. 25
2612
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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