Security in Odoo - Access Control, Record Rules and Group

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ธ.ค. 2024

ความคิดเห็น • 115

  • @warci
    @warci ปีที่แล้ว +1

    Super helpful tutorial! Was really struggling with Odoo permissions concepts

    • @OdooMates
      @OdooMates  11 หลายเดือนก่อน

      Glad you liked it!

  • @abdurrazzak1612
    @abdurrazzak1612 2 ปีที่แล้ว +1

    Great video!

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      Thanks brother for the support ❤️❤️❤️

  • @rembautimes8808
    @rembautimes8808 2 ปีที่แล้ว +1

    Great tutorial - watched it several times. Very comprehensive

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      Glad to hear it

  • @shadanh3556
    @shadanh3556 2 ปีที่แล้ว +1

    You are the best 👍🏻👍🏻👍🏻

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      thanks brother

  • @dabhijaydeep
    @dabhijaydeep 4 ปีที่แล้ว +1

    Well, Explanation. I understand why to use Record rule and access right in Odoo.
    Thanks for sharing the video.

    • @OdooMates
      @OdooMates  4 ปีที่แล้ว

      Glad it was helpful!

  • @ember209
    @ember209 10 หลายเดือนก่อน +1

    My access rights are only visible in debug mode, how can i make it always visible?

  • @manturaj554
    @manturaj554 2 หลายเดือนก่อน

    I have created the hierarchical group. How do I apply the ir.rule for the group in Odoo? Suppose I have four group in hierarchicaly then how to write the ir.rule ???

  • @SamirSELLAMI
    @SamirSELLAMI 2 ปีที่แล้ว

    How to show a custom category created in ir.module.category in the Applications module after affecting a module to it ?

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว +1

      You mean how to add a new module category or

    • @SamirSELLAMI
      @SamirSELLAMI 2 ปีที่แล้ว

      @@OdooMates both custom module and custom category are created. The custom module category in the manifest is affected to the created custom category. My question, why is this custom category is not showing in the left filter tree view in Apps module such as: All, Accounting, Website, Administration, ..Technical..?

  • @muhammedilyas9050
    @muhammedilyas9050 ปีที่แล้ว +1

    Hi, can you please share how we can add User Rights on a particular Action, such as Stage Changing in the Recruitment Module

    • @OdooMates
      @OdooMates  ปีที่แล้ว

      you can add the group to the button

  • @gyanenjayjena9254
    @gyanenjayjena9254 3 ปีที่แล้ว +1

    In odoo we can perform security options i.e, creation of groups,access rights and record rules using both UI and using code,but which is preferable while providing security for any module

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +2

      From the code itself initially add the rules(as odoo provides), and then let user change the rules accordingly

    • @gyanenjayjena9254
      @gyanenjayjena9254 3 ปีที่แล้ว

      @@OdooMates actually my doubt is why code is more preferable as performing security using UI is much easy and time saving.

    • @vickykrishnan6797
      @vickykrishnan6797 3 ปีที่แล้ว +1

      Which one is more preferable - performing security via user interface(UI) or through code? Which one will be best?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      @@vickykrishnan6797 from the code, if you are developing for a client, if you are end user, better doing from ui and if you do from the UI it will be db specific, when you do it in code, it will be available across different db's

    • @vickykrishnan6797
      @vickykrishnan6797 3 ปีที่แล้ว +1

      Thank you so much 😍😍

  • @mohammedajmal3264
    @mohammedajmal3264 3 ปีที่แล้ว +1

    Hi,
    Instead of the check-boxes I want dropdown to be shown so that user can be assigned to only a single group i.e. a user can only be in one of the A,B,C,D groups if I have different groups for a module. How it can be done.(what I mean is to change the type from boolean to selection)

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      set the implied_ids for the groups correctly,so that it will come as selection instead of checkbox, if you have 3 groups, let it be G1, G2 and G2, add G1 in implied_ids of G2, and add G2 in implied_ids of G3, then it will come as selection.
      Refer: Existing groups, sales

    • @mohammedajmal3264
      @mohammedajmal3264 3 ปีที่แล้ว +1

      @@OdooMates Thanks a lot
      I got it from your video itself.

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      @@mohammedajmal3264 welcome brother :)

  • @DuyNguyen-ns2rl
    @DuyNguyen-ns2rl 4 ปีที่แล้ว +1

    hey pro , why class CreateAppointment in wizards , you don't create access right in security/ir.model.access.csv ?

    • @OdooMates
      @OdooMates  4 ปีที่แล้ว +2

      Security is not necessary for the transient.models till odoo13 , it will be added in odoo14

    • @DuyNguyen-ns2rl
      @DuyNguyen-ns2rl 4 ปีที่แล้ว

      Odoo Mates wow thank for sharing pro

  • @dabhijaydeep
    @dabhijaydeep 4 ปีที่แล้ว +3

    Hi
    Can you explain more about in record rule inside this line.
    what others write there eval="[(4, ref(' '))]" means 4,6,3,2 like
    i want to know about it plz explain that one. why we write eval what was use of it

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      (1, ID, { values }) update the linked record with id = ID (write *values* on it)
      (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
      (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
      (4, ID) link to existing record with id = ID (adds a relationship)
      (5) unlink all (like using (3,ID) for all linked records)
      (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

  • @justinpaul2666
    @justinpaul2666 2 ปีที่แล้ว +1

    how can i set as particular module can only see by users in home menu

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      assign a group for the main menu, then users in this group only will be able to see it

    • @justinpaul2666
      @justinpaul2666 2 ปีที่แล้ว

      @@OdooMates but i want to hide existing module like contact ,employees from other user

  • @e.k.7319
    @e.k.7319 2 ปีที่แล้ว

    How can i hide the edit button depends on the condition? For example: if the john created the data nobody can change it. So hide the edit button..

  • @yasirkhan1278
    @yasirkhan1278 2 ปีที่แล้ว +1

    I want to restrict hide and create button from specific groups so I created group and record_rule but still when I add a user in group I still can do both edit and create records in model account.move. Adding code which I do.
    .XML
    Cannot Edit Journal Entries



    Rule To Restrict Edit Journal Entries







    ir.model.access.csv
    access_account_move,access.account.move,model_account_move,sobytek_sbtwo.group_cannot_edit_journal_entries,1,0,0,0
    STILL AFTER LOGGING IN FROM USER WHO IS IN GROUP, I CAN STILL CREATE or EDIT records

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      may be other existing rules for the same model getting conflicted ?

  • @abdellahhajjam6654
    @abdellahhajjam6654 3 ปีที่แล้ว +1

    How can we set access for a module only for administartor ?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      you can create a new user group and set this group for the models, views and menus, and add admin to this group, so only admin will see the changes

  • @jephthah2347
    @jephthah2347 3 ปีที่แล้ว +1

    Great video! How can I set security rights for custom module (I inherited an existing one). So let's say I extended a module and I added a new page in the notebook view or even a new field.

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      what type of security for new page or new field ? for hiding the pages or fields, you can directly give groups="group_name" along with field or page definition, so that it will be visible only for users in this group

    • @jephthah2347
      @jephthah2347 3 ปีที่แล้ว

      @@OdooMates for example to hide a page/field from hr_officer but available to hr_manager. How would I write the page/field definition. I though I could only write model name

  • @bienvenidovillabroza351
    @bienvenidovillabroza351 4 ปีที่แล้ว +1

    Is there a way to setup field level access rights on the object? (not just the view)

    • @OdooMates
      @OdooMates  4 ปีที่แล้ว +1

      quotation_count = fields.Integer('Quotation Count', groups='sales_team.group_sale_salesman', compute="_compute_quotation_count")

    • @bienvenidovillabroza351
      @bienvenidovillabroza351 4 ปีที่แล้ว

      This solution will work if I need that attribute to be either both read and write or neither read nor write. In other words, it will not be sufficient if I need the field to be only read and not writable.

  • @МасюнасЕвгений
    @МасюнасЕвгений 3 ปีที่แล้ว +1

    Hello everyone. How to modify the rights so that the manager can see all the records, but edit which is his own?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      if you need to modify existing rules, that allows manager to edit all the records, find the rule that grand edit access for manager, you can go the record rules menu and filter the rules of particular model and can find the rule. Then you can inherit it in your model and remove edit access from it. Add a new rule with domain(to get only his record) and then grand edit access.

  • @edinson6199
    @edinson6199 4 ปีที่แล้ว +1

    How can select default group for application, when i create a new User?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      If the question is about the default access rights for newly created users, see this: th-cam.com/video/JeBRg_iXQHY/w-d-xo.html

  • @imrantechexpert
    @imrantechexpert 2 ปีที่แล้ว +1

    Excellent, thank you for elaborating step by step

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      Glad you liked it

  • @arvindgupta4146
    @arvindgupta4146 3 ปีที่แล้ว +1

    Watching your security video i give the permission the user is perm_unlink=0 and manager give tha all the permission but both will be able to delete,how we can set that usee cannot be able to delete and maneger can do please help

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      can you make sure that the testing user is only in the users group and not in managers group

  • @waltergabriele
    @waltergabriele 3 ปีที่แล้ว +1

    Super video Thank You!

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      welcome bro

  • @user-gf3hf5ri8b
    @user-gf3hf5ri8b 2 ปีที่แล้ว

    Really beautiful video! Appreciate it very much.

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      thanks brother for the support

  • @sahardagher3127
    @sahardagher3127 3 ปีที่แล้ว +1

    Thank you, How to hide category administration from user form?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      for all the users ?

    • @sahardagher3127
      @sahardagher3127 3 ปีที่แล้ว

      @@OdooMates yes for all users or only for users not in setting group

  • @trungphung1855
    @trungphung1855 3 ปีที่แล้ว +1

    how can i set access right use group of another module
    For example: i want to set access right use group of hr module
    thanks a lot

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      in the csv file, you can set the model as hr.model_hr_employee , like this

  • @megasaab2915
    @megasaab2915 5 ปีที่แล้ว +1

    How can I set some permission by checkbox in settings when I admin?

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว +1

      See this : th-cam.com/video/-6KncTZIiX0/w-d-xo.html

  • @OUASSINIFASLA
    @OUASSINIFASLA 8 หลายเดือนก่อน

    Thanks, it helps a lot Good job

    • @OdooMates
      @OdooMates  6 หลายเดือนก่อน

      You're welcome!

  • @alaouibelritiikram7290
    @alaouibelritiikram7290 4 ปีที่แล้ว +1

    Please how can i make planned_hours for project module *not editable for user* and * editable for manager * thank you in advance

    • @OdooMates
      @OdooMates  4 ปีที่แล้ว

      You can add attrs readonly in the code, for this you have to add a boolean field in the model and compute the value to it, during computation check users group and based on this field make the field readonly. Hope you get some idea :)

  • @norajameel9354
    @norajameel9354 2 ปีที่แล้ว +1

    thank you so much sir!

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว +1

      Glad it helped ❤️

  • @LeonardoJCaballeroG
    @LeonardoJCaballeroG 5 ปีที่แล้ว +1

    Great video, for me it was very useful!!!

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว +1

      Such comments are our energy/vibe to create more videos in the development tutorials. Hope you will like and subscribe the channel and support us

    • @LeonardoJCaballeroG
      @LeonardoJCaballeroG 5 ปีที่แล้ว +1

      Sure, I already subscribed, please, continue with this videos!!!

  • @maaneadel2815
    @maaneadel2815 3 ปีที่แล้ว +1

    bro can you help me with this error please
    ValueError: Expected singleton: MyClass(2, 3, 4)

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      iterate self over a for loop, can you show me the code where you gets the error

    • @maaneadel2815
      @maaneadel2815 3 ปีที่แล้ว

      @@OdooMates File "/home/adel/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
      result = request.dispatch()
      File "/home/adel/odoo/odoo/http.py", line 683, in dispatch
      result = self._call_function(**self.params)
      File "/home/adel/odoo/odoo/http.py", line 359, in _call_function
      return checked_call(self.db, *args, **kwargs)
      File "/home/adel/odoo/odoo/service/model.py", line 94, in wrapper
      return f(dbname, *args, **kwargs)
      File "/home/adel/odoo/odoo/http.py", line 347, in checked_call
      result = self.endpoint(*a, **kw)
      File "/home/adel/odoo/odoo/http.py", line 912, in __call__
      return self.method(*args, **kw)
      File "/home/adel/odoo/odoo/http.py", line 531, in response_wrap
      response = f(*args, **kw)
      File "/home/adel/odoo/addons/web/controllers/main.py", line 1377, in call_kw
      return self._call_kw(model, method, args, kwargs)
      File "/home/adel/odoo/addons/web/controllers/main.py", line 1369, in _call_kw
      return call_kw(request.env[model], method, args, kwargs)
      File "/home/adel/odoo/odoo/api.py", line 396, in call_kw
      result = _call_kw_multi(method, model, args, kwargs)
      File "/home/adel/odoo/odoo/api.py", line 383, in _call_kw_multi
      result = method(recs, *args, **kwargs)
      File "/home/adel/odoo/odoo/models.py", line 3021, in read
      self._read(stored_fields)
      File "/home/adel/odoo/odoo/models.py", line 3167, in _read
      field.read(fetched)
      File "/home/adel/odoo/odoo/fields.py", line 3158, in read
      group[get_id(line[inverse])].append(line.id)
      File "/home/adel/odoo/odoo/models.py", line 5639, in __int__
      return self.id or 0
      File "/home/adel/odoo/odoo/fields.py", line 3809, in __get__
      raise ValueError("Expected singleton: %s" % record)
      Exception
      The above exception was the direct cause of the following exception:
      Traceback (most recent call last):
      File "/home/adel/odoo/odoo/http.py", line 639, in _handle_exception
      return super(JsonRequest, self)._handle_exception(exception)
      File "/home/adel/odoo/odoo/http.py", line 315, in _handle_exception
      raise exception.with_traceback(None) from new_cause
      ValueError: Expected singleton: gi.classroom(9, 10, 11)

    • @maaneadel2815
      @maaneadel2815 3 ปีที่แล้ว +1

      @@OdooMates the code
      class GiClass(models.Model):
      _name = "gi.classroom"
      _inherit = ['mail.thread']
      _description = "les classroom du département de Genie Industriel"
      _rec_name = 'nom'
      nom = fields.Char(string='Code du grupe', required=True)
      etudiants = fields.One2many('gi.etudiant', 'classroom', string='Etudiants')
      professeurs = fields.One2many('gi.professeur', 'classroom', string='Professeurs')
      cours = fields.One2many('gi.cours', 'classroom', string='Etudiants')
      examens = fields.One2many('gi.cours', 'classroom', string='Examens')
      num = fields.Char(string='Numéro du classroom', required=True)

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      Can you send me the code part that throws the errror

    • @maaneadel2815
      @maaneadel2815 3 ปีที่แล้ว +1

      @@OdooMates when i add 2 or 3 classroom
      classroom = fields.Many2many('gi.classroom', string="Groupe")

  • @patildipika8076
    @patildipika8076 5 ปีที่แล้ว +1

    Very helpful video.

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว

      Happy to hear it. Hope you will refer the channel to your friends. Also support us by like and subscribe the channel

  • @yasirkhan4392
    @yasirkhan4392 3 ปีที่แล้ว +1

    I am working on a module, whose main purpose is to restrict product creation for a certain group of users. I tried multiple ways but the problem is not solved still.
    Let me be more clear:
    I created a group named (Restrict To Create Products) and I have added some users in this group now I want to restrict this group from creating products.
    Any help would be really appreciated.
    Thank You

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      Hi, you can override the create method of the product model and check whether the users is in this group, if user is in this group, we can block the creation by showing the warning

  • @kenzasouabni
    @kenzasouabni 2 ปีที่แล้ว +1

    i took off the superuser and then my module was disappeared not like in this video

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      if you are new to odoo, feel free to watch video in the order of playlist for better understanding: th-cam.com/video/r11U1pqGqQQ/w-d-xo.html

    • @kenzasouabni
      @kenzasouabni 2 ปีที่แล้ว

      @@OdooMates Thank you you are the best

  • @hannayoo2059
    @hannayoo2059 5 ปีที่แล้ว

    It is so helpful for me .Thank you very much.

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว +1

      Hope you will like the video and subscribe the channel and support us :)

  • @MuhammadImranSarwar-dh4rv
    @MuhammadImranSarwar-dh4rv 5 ปีที่แล้ว

    Sir it's very nice video. you have well explained about groups and users but you missed one thing which was a company. you have not explained about it nor you have made other video related to company can you do that. i want to add new tab in company view but i face problem can you help me please.

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว

      Regarding the companies, if you look how the security across companies are done, it is purely using the record rules right ...

    • @OdooMates
      @OdooMates  5 ปีที่แล้ว

      What is the issue you face in adding new tab in company page .... please let us know

    • @MuhammadImranSarwar-dh4rv
      @MuhammadImranSarwar-dh4rv 5 ปีที่แล้ว

      @@OdooMates Sir when i try to add this record
      Your New barcode Company
      it's working when i try to add new tab go to this link there is screenshot apps.odoo.com/apps/modules/13.0/sh_barcode_generator_simple/ i want to develop like that when i put this code for new tab

      Your New barcode Company

      This is an example of notebooks

      and run it's says File "src/lxml/lxml.etree.pyx", line 3501, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:184715)
      AssertionError: Element odoo has extra content: data, line 3 Please help me to fix this please.

  • @quique4x4123
    @quique4x4123 5 ปีที่แล้ว +1

    Thank you very much. Its was very helpfull

    • @OdooMates
      @OdooMates  4 ปีที่แล้ว

      happy to hear it

  • @mohamedlellah8318
    @mohamedlellah8318 3 ปีที่แล้ว +1

    Thank you very much

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      Welcome bro ❤❤

  • @mahmoudkhodeir531
    @mahmoudkhodeir531 5 ปีที่แล้ว +1

    that is great brother

  • @AdeshPaul
    @AdeshPaul 4 ปีที่แล้ว +1

    Thanks.

  • @fidiaryaarmidi7321
    @fidiaryaarmidi7321 3 ปีที่แล้ว +1

    It is so helpful for me .Thank you very much.

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      happy that it helped