Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Separate groups for AR and AP user

Subscriure's

Get notified when there's activity on this post

This question has been flagged
securityaccounting
1 Respondre
1100 Vistes
Avatar
SIA, MILWELL HUI

In Odoo if you are member of any accounting group, you can access both AR and AP records

Using groups in menus can separate access, but this can easily be bypassed by bookmarking the URL  like "http://odoo16/web#action=249&model=account.payment&view_type=list&cids=1"

Is there a more secure way of preventing access?  I'm thinking of a custom search function.  But is there a better way? 

0
Avatar
Descartar
Avatar
SIA, MILWELL HUI
Autor Best Answer

I have found solution by overriding the controller

import logging

from odoo.addons.web.controllers.action import Action

from odoo.exceptions import AccessDenied

from odoo.http import Controller, request, route



_logger = logging.getLogger(__name__)



class SecureAction(Action):


@route('/web/action/load', type='json', auth="user")

def load(self, action_id, additional_context=None):

retval = super().load(action_id, additional_context)

if 'id' in retval:

window_action = request.env['ir.actions.act_window'].sudo().browse(retval.get('id'))

if window_action.allowed_groups_id:

if not any(allowed_group in request.env.user.groups_id for allowed_group in window_action.allowed_groups_id):

raise AccessDenied(

'{} ({}) can only be accessed by {}'.format(

window_action.display_name,window_action.xml_id,', '.join(window_action.mapped('allowed_groups_id.full_name')))

)

return retval

Also adding special field in Window Action

from odoo import models, fields, api, _

from datetime import datetime, timedelta

import logging


_logger = logging.getLogger(__name__)


class WindowAction(models.Model):

_inherit = 'ir.actions.act_window'


allowed_groups_id = fields.Many2many('res.groups',relation="rel_allowed_groups_window_action")


View code

<odoo>

<record id="view_window_action_form" model="ir.ui.view">

<field name="inherit_id" ref="base.view_window_action_form"/>

<field name="model">ir.actions.act_window</field>

<field name="arch" type="xml">

<notebook>

<page name="allowed_groups" string="Allowed Groups">

<field name="allowed_groups_id" nolabel="1">

<tree editable="bottom">

<field name="full_name"/>

</tree>

</field>

</page>

</notebook>

</field>

</record>

</odoo>

Anybody else have another idea? 







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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Can I perform multi-division accounting and security?
security salesteams accounting
Avatar
0
de març 15
4317
I found a small typo in the Odoo 19 Chart of Accounts — and it made my day 😆 Solved
accounting
Avatar
Avatar
Avatar
2
de nov. 25
165
Invoice-Digitize-Individual Line Items
accounting
Avatar
Avatar
1
de nov. 25
433
Guía~Básica¿Cómo hablo con una persona en vivo en Delta?
accounting
Avatar
0
de nov. 25
3
How can I manipulate the email template when sending an email in Accounting so that my PDF with the XML is inserted instead of the standard view with XML?
accounting
Avatar
Avatar
1
de nov. 25
246
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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