← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 712254] Re: [stable 6.0][trunk]property fields deleted for other companies if Admin user in multiple companies

 

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!

** Changed in: openobject-server
   Importance: Undecided => Medium

** Changed in: openobject-server
       Status: Triaged => Confirmed

** Changed in: openobject-server
    Milestone: None => 6.0.2

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/712254

Title:
  [stable 6.0][trunk]property fields deleted for other companies if
  Admin user in multiple companies

Status in OpenERP Server:
  Confirmed

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_template(osv.osv):
      _inherit = "product.template"
      _description = "Product Template"
      _columns={
          'supply_method': fields.property('product.template',
              type='char',
              string='Supply Method',
              method=True,
              view_load=True,
              required=True,
              help="Produce will generate production order or tasks, according to the product type. Purchase will trigger purchase orders when requested. This has been overridden values other than 'produce' or 'buy' will cause errors"),
          }
  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_account_payable
  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?



References