Code Monkey home page Code Monkey logo

Comments (13)

keshrath avatar keshrath commented on September 28, 2024

I can't find a call to one of our modules in the stacktrace

from muk_base.

MathAndrews avatar MathAndrews commented on September 28, 2024

Sorry, I updated my previous comment with the correct stacktrace

from muk_base.

gsisa avatar gsisa commented on September 28, 2024

Hi, i resolve con this patch:

--- a/muk_security/models/res_users.py
+++ b/muk_security/models/res_users.py
@@ -49,17 +49,17 @@ class AccessUser(models.Model):
     # Functions
     #----------------------------------------------------------

-    def browse(self, arg=None, *args, **kwargs):
+    def browse(self, arg=None, prefetch=None):^M
         if isinstance(arg, helper.NoSecurityUid):
             arg = super(helper.NoSecurityUid, arg).__int__()
-        return super(AccessUser, self).browse(arg=arg, *args, **kwargs)
+        return super(AccessUser, self).browse(arg=arg, prefetch=prefetch)^M


     @classmethod
-    def _browse(cls, ids, *args, **kwargs):
+    def _browse(cls, ids, env, prefetch=None, add_prefetch=True):^M
         def convert_security_uid(id):
             if isinstance(id, helper.NoSecurityUid):
                 return super(helper.NoSecurityUid, id).__int__()
             return id
         access_ids = [convert_security_uid(id) for id in ids]
-        return super(AccessUser, cls)._browse(access_ids, *args, **kwargs)
+        return super(AccessUser, cls)._browse(access_ids, env=env, prefetch=prefetch, add_prefetch=add_prefetch)^M

from muk_base.

keshrath avatar keshrath commented on September 28, 2024

But than it would be no longer compatible with older versions and actually it shouldn't change anything about the implementation. Thats why I use *args and **kwargs, they are more generic.

from muk_base.

gsisa avatar gsisa commented on September 28, 2024

the error that @MathAndrews report continue.

Latest error lines:

File "/opt/odoo/11.0/community/odoo/models.py", line 2737, in _read_from_database
    target = self.browse([], self._prefetch)
  File "/home/odoo/11.0/addons/muk-it/muk_base/muk_security/models/res_users.py", line 55, in browse
    return super(AccessUser, self).browse(arg=arg, *args, **kwargs)
TypeError: browse() got multiple values for argument 'arg'

Debian Stretch 64 bits
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
odoo 11.0 CE
commit 85cbb070ad0223d76abff42532999d36f712f222
Author: Nans Lefebvre [email protected]
Date: Mon May 13 09:10:54 2019 +0000

from muk_base.

gsisa avatar gsisa commented on September 28, 2024

Hi @keshrath , in which situation this condition is true?

https://github.com/muk-it/muk_base/blob/11.0/muk_security/models/res_users.py#L53

thanks

from muk_base.

keshrath avatar keshrath commented on September 28, 2024

If you use suspend_security like self.suspend_security().read([])

from muk_base.

gsisa avatar gsisa commented on September 28, 2024

Hello,

index c34988a..6cadd98 100644
--- a/muk_security/models/res_users.py
+++ b/muk_security/models/res_users.py
@@ -48,13 +48,14 @@ class AccessUser(models.Model):
     #----------------------------------------------------------
     # Functions
     #----------------------------------------------------------
-
-    def browse(self, arg=None, *args, **kwargs):
-        if isinstance(arg, helper.NoSecurityUid):
-            arg = super(helper.NoSecurityUid, arg).__int__()
-        return super(AccessUser, self).browse(arg=arg, *args, **kwargs)
-
-
+^M
+    def browse(self, *args, **kwargs):^M
+        if len(args) and isinstance(args[0], helper.NoSecurityUid):^M
+            args = list(args)^M
+            args[0] = super(helper.NoSecurityUid, args[0]).__int__()^M
+            args = tuple(args)^M
+        return super(AccessUser, self).browse(*args, **kwargs)^M
+^M
     @classmethod
     def _browse(cls, ids, *args, **kwargs):
         def convert_security_uid(id):

from muk_base.

keshrath avatar keshrath commented on September 28, 2024

Looks good, if it solves the problem. Can you do a PR?

from muk_base.

gsisa avatar gsisa commented on September 28, 2024

Hello, remote: Permission to muk-it/muk_base.git denied to gsisa.

from muk_base.

keshrath avatar keshrath commented on September 28, 2024

ah pull request is not a push: https://help.github.com/en/articles/creating-a-pull-request

from muk_base.

keshrath avatar keshrath commented on September 28, 2024

ce92d61

from muk_base.

MathAndrews avatar MathAndrews commented on September 28, 2024

Thanks

from muk_base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.