İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Grant portal access automatically when contact is created

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
automatedportal-userodoo.shv12
4 Cevaplar
12066 Görünümler
Avatar
Chris Leray

HI, 


I am trying to create an automated action in order to automatically grant portal access to a new contact. 

As right now if you create a new contact from the POS they don't have access to the website so they have to create a new account and then contacts are duplicated.

Maybe there is better to do it than automated action?

thanks, 

0
Avatar
Vazgeç
Avatar
Paresh Wagh
En İyi Yanıt

Hi Chris:

Using an automated action is the simplest and most elegant way of doing this.

EDIT:

Create an automated action on the Contact (res.partner) model with a Trigger Condition of On Creation and Action To Do of Execute Python Code

Put the following code in the Python Code field:

# Ensure an email address has been entered so that it can be used for the login
if not record.email:
    raise Warning("Please enter an email address.")

x_group_portal_user = env.ref('base.group_portal')
env['res.users'].create([{'name': record.name,
                          'login': record.email,
                          'partner_id': record.id,
                          'company_id': env.company.id, 
                          'groups_id': [(6, 0, [x_group_portal_user.id])],
                          }],)

1
Avatar
Vazgeç
Chris Leray
Üretici

thanks for your message. I have tried to create this automated action but it still does now work. I am not sure about the loving there and python code I should add ?

any chance u can help?

thanks

Paresh Wagh

Hi Chris: I have edited my post and added the details.

Chris Leray
Üretici

awesome, thanks a lot, it works perfectly. I just add to remove the 'company_id': env.company.id,

but all good.

Chris Leray
Üretici

Actually I realized that with this script it also publish the contact on the website which I don't want to.

I want to grant them the access but don't want to publish the contact on the website if that make sense.

I had a look at my group and it looks like my grant port is id = 9 and not 6. I changed it to 9 but then it does now work.

I think this is not the same group, what am i missing here?

sorry, thanks a lot

Paresh Wagh

Hi Chris:

The (6,0,...) part is the syntax for populating one2many/many2many fields. The "6" indicates that the existing groups assigned to this user need to be removed and replaced with the portal user group. If you need more groups to be assigned to the user, you will need to add their ref ids to the array of group ids on the right.

Here's a link to the documentation (you will have to scroll down a bit to the one2many.many2many part):

https://www.odoo.com/documentation/13.0/reference/orm.html#create-update

Regarding the question about the Contact getting published to the website, when I try this out in my environment, the Contact is not getting automatically published. There must be something else in your environment that is triggering off the publish.

You can try to get around this by adding the following line at the end of the code (after the create).

record['is_published'] = False

This will reset the published flag to False even if it gets set to True somewhere else.

NOTE: You may want to use this as a last resort only if you cannot find what is automatically triggering the publish.

Chris Leray
Üretici

ok I see, this is really helpful thanks a lot. I will try to understand where is this coming from

thanks ,

Cherry Rose Sanchez

hi can you add a condition, wherein portal access will be granted only if the contact has that information. otherwise, it will skip. example: a custom field "portal_user" is true before granting portal access upon creation? and does it work if odoo bot created the contact via website?

Avatar
Luke Austin
En İyi Yanıt

I'm using this ina  slightly different context - ie on sales order confirmation, so I need to check if theuser has already been granted portal access.

I've tried a few things, like:

if not record.partner_id.has_group('base.portal_users'):

Which doesn't work, because it's addressing the partner, not the user but I can't see how to get from record to the user group. How would you add a conditional to exclude existing portal users from this code? 

0
Avatar
Vazgeç
Avatar
MUHAMMAD Imran
En İyi Yanıt

Just do simplify,

In wizard just replace your apply button with following button

<button name="1174" type="action" string="Apply"/>

here name is the id of your server action. 

In server action you can add the code like,

for rec in records:

  for userin rec.user_ids:

    user['in_portal'] = True

 rec.action_apply()

Video : https://youtu.be/Mjr-RpITSC0

0
Avatar
Vazgeç
Diego Riera Diaz

Hi Muhammad,

I am new to Odoo dev. Looking at your video and in V15. Did you create a new server action or updated an existing one ?

Thanks you !

Diego

Avatar
Chris TRINGHAM
En İyi Yanıt

Paresh's solution works, and will automatically create portal access for all contacts, so you might want to add "Apply On": Customer Rank is set

 [["customer_rank","!=",False]]
One other suggestion.  If you create customers through the normal Odoo user interface (and not POS), there is an action to "add portal access" (you can do this for multiple customers from the list view or for individual customers using the Form View).


This image has an empty alt attribute; its file name is grant-portal-access-list-view.jpg

This image has an empty alt attribute; its file name is grant-portal-access.jpg
0
Avatar
Vazgeç
Chris Leray
Üretici

great thanks a lot for your help:) all good

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Add a Mailing contact automatically to a mailing list Çözüldü
python automated mailing odoo.sh v12
Avatar
Avatar
Avatar
Avatar
Avatar
12
Nis 24
14506
Automated action with python expression Çözüldü
action python automated odoo.sh v12
Avatar
Avatar
6
Mar 24
10685
How to code Automated Action to update a ManytoOne custom field to match source field?
automated v12
Avatar
Avatar
2
Tem 19
6628
[v12] adding field to res_partner breaks odoo.sh instance Çözüldü
odoo.sh v12 upgrad
Avatar
Avatar
3
Ağu 21
4547
How to access sudo on Odoo.sh? v12
sudouser odoo.sh v12
Avatar
Avatar
3
Ağu 19
10479
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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