← Back to team overview

openerp-connector-community team mailing list archive

Openerp-connector and Multi-company

 

Hi,

For one of our projects, the connector will be used in a multi company
environment. When looking deeper in the code it seems that nothing exists
to link a queue.job to a company in a way that it will be possible to
restrict the visibility of a job to members of a company and to send
notification only to members of that company.

To support the use case I propose to:


   - add a new field company_id on the queue_job model (optional)
   - modify the method OpenERPJobStorage.enqueue to fill the company_id
   with the following logic:

  company_id = self.session.context.get('company_id')

  if not company_id:

      company_id
> = self.sesion.pool.get('res.company')._company_default_get(cr, uid,
> object='queue.job', field='company_id', context=context)

  job.company_id = company_id



   - add a record rule on queue.job to restrict the visibility by company
   - modify the method QueueJob.subscribe_users to add the company_id as
   parameter to the search method.

What do you think?

Regards,

lmi

Follow ups