Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Strange behavior of record rule

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
userscreaterulerecord
1 Răspunde
6929 Vizualizări
Imagine profil
Tomas Parnarauskas

I encountered strange behavior of custom access rule and it happens at only one database (don't know how it is different from others). So I created this record rule (on res.partner object for read, write, create and delete):

['|',('user_id','=',user.id),('user_id','=',False)]

When I create new user and give it group with this rule it gives me error when I try to create new partner (or when I try to open that users window, for example through salesperson field (it looks like that user don't have access to himself..)):

image description

The stranger thing is that this error does not show up with old users. When I give them same access rights, it creates new partners without problems. Also if I duplicate old user it also bypasses this error. So it seems something is wrong with creating new users.

I also tried to backup and restore that database to another server where are no such problems, but it gives this error there too. So it seems modules are fine. Something has to be with configuration in database, but I don't know what could be wrong. Any ideas?

EDIT: I managed to pinpoint why this rule was behaving so strange with newly created users. The problems seems to be with module I created. That module sets default salesman on partner when it presses create button in partners view. For example if John Doe presses button to create new partner he will be automatically assigned as salesman to that partner. Somehow this module blocks new users as being default ones for salesman on any partner. With old users (before installing that module) it works even when that module is installed.

My module is very simple, but I don't see it why it corrupts newly created users (and only when record rule that I talked earlier about is applied). Code looks like this:

from openerp.osv import osv

class res_partner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'
    _defaults = {
        'user_id': lambda obj, cr, uid, context: uid,
    }

res_partner()

Should such module have to be defined somehow differently? Or did I miss something?

0
Imagine profil
Abandonează
Imagine profil
ClueLogics Technologies Pvt. Ltd.
Cel mai bun răspuns

Hi

this problem happen many time because, there is a security rule already added for this case

for solved it you have to do one thing

  1.  your user company should be false (means no company selected )  or the main company  in ` user record`
   or
  2 . you will have to create a complete rule for that company if company is change and you want to select new company for this user

then there will be no error's

even you can check it, just inactive that rule (a default rule) from settings - --> technical --> security --> records rules menu , then you will see that this error never happen

Thanks
Sandeep

2
Imagine profil
Abandonează
Tomas Parnarauskas
Autor

I tried to make inactive 'user rule'. But problem is still here (I tried to disable default company rule too). Also in my database there is only one company. And it seems strange that old users don't get this error, when they are added to the same company as new users. Am I doing something wrong?

ClueLogics Technologies Pvt. Ltd.

must check res.partner company rule , for same company there should not be any problem

Tomas Parnarauskas
Autor

I disabled that rule, but still getting this error. Don't understand what's wrong. Also it does not happen in any other database (record rules are the same) with or wthout checking res.partner company rule.

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Record rule doesn´t remove Form Edit Button Rezolvat
rule record
Imagine profil
Imagine profil
1
oct. 22
7153
Private Address option when I create a new user
users create
Imagine profil
Imagine profil
1
sept. 20
6089
Allow a user to access only records that were created by him Rezolvat
users create record_rules
Imagine profil
Imagine profil
1
iun. 20
12424
Create co-record on create(self,vals) model
create mrp record
Imagine profil
Imagine profil
1
ian. 20
6243
how to change the order who one2many create new records with editable=“bottom”?
one2many create record
Imagine profil
0
sept. 15
4649
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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