[stable 6.0][trunk]property fields deleted for other companies if Admin user in multiple companies
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Committed
|
Medium
|
OpenERP's Framework R&D |
Bug Description
This one is really hard to describe. Basically I needed to override the supply_method selection field in product module to make it a char so products we produce in one company but buy in others can be kept together.
I did this with this code.
class product_
_inherit = "product.template"
_description = "Product Template"
_columns={
}
product_template()
If I modify products as a normal user of Company A -> expected results occur in db, product template form & in configuration -> parameters.
However if i modify as Admin user (with full rights to all companies and groups) in HQ company, it modifies the HQ entry as expected, but deletes the Company A entry.
If I remove admin user from Company A it still deletes company A entry.
If I create a new HQ user (with full rights to HQ and all groups) it behaves as expected.
If I add Company A to HQ user rights (full rights to companies and groups) it behaves as expected.
Next I checked a many2one field not coded by me -> property_
Selected a partner and gave them a creditor account in Company A and HQ using the users A and HQ
Updating by any other user is fine, updating as Admin deletes the entries for other companies.
So what is going on with Admin user in property fields?
Related branches
- Yogesh (SerpentCS) (community): Needs Resubmitting
- Naresh(OpenERP): Pending requested
-
Diff: 65 lines (+15/-10)1 file modifiedopenerp/osv/fields.py (+15/-10)
- OpenERP Core Team: Pending requested
-
Diff: 40 lines (+7/-6)1 file modifiedopenerp/osv/fields.py (+7/-6)
- OpenERP Core Team: Pending requested
-
Diff: 101 lines (+48/-42)1 file modifiedopenerp/osv/fields.py (+48/-42)
Changed in openobject-server: | |
status: | New → Triaged |
Changed in openobject-server: | |
status: | Confirmed → In Progress |
Changed in openobject-server: | |
status: | Fix Committed → Confirmed |
milestone: | 6.0.2 → none |
Hello Graeme,
Your explanation is perfectly clear, and after scanning the code for a second, it looks like the framework will try to delete the current value for the property before assigning the new value, and does so according to the current property value you are supposed to see.
However as the admin user bypasses completely all access rules (ir.rule entries), it is in fact allowed to see all property values, and they end up all deleted.
We need to improve that logic and properly update the values no matter what other values you can access.
Thanks for the excellent bug report!