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
    • E-learning
    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
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor 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
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

Onchange y self.env.company not work

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
invoicemexicoodoo16features
2 Antwoorden
2755 Weergaven
Avatar
Manuel Garcia

Hello, I have a problem with the onchange event that is not working completely in multi-company. The instruction self.env.company is not returning the current company. Can you help me identify what could be failing, if there is any solution or if it is an Odoo bug that needs to be fixed. The problem had not arisen until multiple companies with different RFCs began to be used. The restriction validates that the mx_customer_rfc field is the same as the company’s. So the problem is that self.env.company always returns the same company regardless of whether the user is moving from company to company. What I identified is that outside of onchange it does work, it is even the classic way to assign the default company (default=lambda self:self.env.company).


@api.constrains('mx_customer_rfc')
def _check_customer_rfc(self):
for record in self:
if record.mx_customer_rfc and record.mx_customer_rfc != self.env.company.vat and (record.move_type == 'in_invoice' or record.move_type == 'in_refund' or record.move_type == 'in_receipt'):
raise ValidationError('El RFC del receptor (%s) no corresponde con el RFC de %s (%s)' %
(record.mx_customer_rfc, self.env.company.name, self.env.company.vat))



0
Avatar
Annuleer
Manuel Garcia
Auteur

@Niyas Raphy
Hi,
Yes, it’s correct, you have multi-company mode enabled and several companies selected in the company switcher, that is, in the menu bar, and you understand that self.env.company will return the first selected company. However, when using @api.constrains for some strange reason it no longer works, it always returns the same company regardless of whether you are switching between companies from the menu bar.

Thanks

Avatar
Manuel Garcia
Auteur Beste antwoord

@Niyas Raphy

Hi,
Yes, it’s correct, you have multi-company mode enabled and several companies selected in the company switcher, that is, in the menu bar, and you understand that self.env.company will return the first selected company. However, when using @api.constrains for some strange reason it no longer works, it always returns the same company regardless of whether you are switching between companies from the menu bar.

Thanks


0
Avatar
Annuleer
Avatar
Niyas Raphy (Walnut Software Solutions)
Beste antwoord

Hi,
If you have multi company enabled and multiple companies selected in the company switched, ie, in the menu bar, self.env.company will return the first select company .

And this will return the selected company properly, can you confirm that are you looking for the same or you are looking for the company selected in the record ?

If you need to check with company set in the record, use self.company_id instead of self.env.company

Thanks

0
Avatar
Annuleer
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
Add bank account number under company details of a invoice - Odoo 16 Community Edition Opgelost
invoice odoo16features
Avatar
Avatar
1
mrt. 24
1476
How to place a foreach loop inside a <td> in a QWEB Report Opgelost
invoice odoo16features
Avatar
Avatar
1
jul. 23
4890
How to place a foreach loop inside a <td> in a QWEB Report
invoice odoo16features
Avatar
0
jul. 23
25
Link Invoice and Sale order In Odoo 16.4
invoice sales.order odoo16features
Avatar
Avatar
1
dec. 24
4125
Odoo 16. Report same report has two different faces.
invoice reports odoo16features
Avatar
Avatar
1
dec. 23
3856
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
  • Partner worden
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 Svenska ภาษาไทย 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