openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #12304
[Bug 1010588] [NEW] "# uid == 1 for accessing objects having rules defined on store fields"
Public bug reported:
Environment is openerp-server-6.0.3 in a Multi-Company environment.
Seems that when using store=True on a function field, that function is
called with uid=1 in some situations instead of with the uid of the user
logged in at the time.
In this multi-company environment, I have been using rules on objects to
determine what a user from each company sees/has access to and also as a
filter.
For example, the three companies are sharing SKUs (product.product) but
each have their own separate taxes on these products.
So far that has worked out just fine - when making a sale, only the
taxes that the user logged in can access are applied to the sale.
But now that I have added "store=True" and "store={ ... }" to some
fields since uid=1 n the initial access of these fields all three taxes
records are being applied to sales caclulations.
What I am not too sure of is if this is a bug or whether my method of
manipulating things using permissions/user.company_id is a bad hack.
I have checked v 6.1 and it does the same thing with uid:
ubuntu@ip-10-160-70-30:/opt/openerp/openerp-server/bin/osv$ nano +3789 orm.py
...
for key in keys:
val = todo[key]
if key:
# uid == 1 for accessing objects having rules defined on store fields
result = self._columns[val[0]].get(cr, self, ids, val, 1, context=context)
for id, value in result.items():
...
** Affects: openobject-server
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1010588
Title:
"# uid == 1 for accessing objects having rules defined on store
fields"
Status in OpenERP Server:
New
Bug description:
Environment is openerp-server-6.0.3 in a Multi-Company environment.
Seems that when using store=True on a function field, that function is
called with uid=1 in some situations instead of with the uid of the
user logged in at the time.
In this multi-company environment, I have been using rules on objects
to determine what a user from each company sees/has access to and also
as a filter.
For example, the three companies are sharing SKUs (product.product)
but each have their own separate taxes on these products.
So far that has worked out just fine - when making a sale, only the
taxes that the user logged in can access are applied to the sale.
But now that I have added "store=True" and "store={ ... }" to some
fields since uid=1 n the initial access of these fields all three
taxes records are being applied to sales caclulations.
What I am not too sure of is if this is a bug or whether my method of
manipulating things using permissions/user.company_id is a bad hack.
I have checked v 6.1 and it does the same thing with uid:
ubuntu@ip-10-160-70-30:/opt/openerp/openerp-server/bin/osv$ nano +3789 orm.py
...
for key in keys:
val = todo[key]
if key:
# uid == 1 for accessing objects having rules defined on store fields
result = self._columns[val[0]].get(cr, self, ids, val, 1, context=context)
for id, value in result.items():
...
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1010588/+subscriptions
Follow ups
References