← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 789832] [NEW] Can not get a sequence_id from a child company

 

On Sunday 29 May 2011, you wrote:
> Public bug reported:
> 
> In V6, how to reproduce the bug:
> 2 companies, A is child of B.
> 2 invoice sequences, one for A and one for B.
> User X with company B as main company should be able to watch all objects
> from company B and A. When user X is entering a new invoice for company A,
> no sequence_id is generated. This is due to the fact that in
> ir_sequence/get_id the following code seems incorrect:
> 
>         company_id = self.pool.get('res.users').read(cr, uid, uid,
> ['company_id'], context=context)['company_id'][0] or None


Hmm. Smells dead fish here..

The company_id of the ir.sequence must match the one of the journal. Or 
shouldn't be considered at all..

Why would the sequence ever be affected by the /user/ doing the operation, 
rather than the /object/ receiving the sequence number?

Using the current code, *please* have distinct sequences per journal, and have 
company_id=NULL at all of them.


-- 
Say NO to spam and viruses. Stop using Microsoft Windows!

-- 
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/789832

Title:
  Can not get a sequence_id from a child company

Status in OpenERP Server:
  Confirmed

Bug description:
  In V6, how to reproduce the bug:
  2 companies, A is child of B.
  2 invoice sequences, one for A and one for B.
  User X with company B as main company should be able to watch all objects from company B and A.
  When user X is entering a new invoice for company A, no sequence_id is generated. This is due to the fact that in ir_sequence/get_id the following code seems incorrect:

          company_id = self.pool.get('res.users').read(cr, uid, uid, ['company_id'], context=context)['company_id'][0] or None
          cr.execute('''SELECT id, number_next, prefix, suffix, padding
                        FROM ir_sequence
                        WHERE %s=%%s
                         AND active=true
                         AND (company_id = %%s or company_id is NULL)
                        ORDER BY company_id, id
                        FOR UPDATE NOWAIT''' % test,
                        (sequence_id, company_id))
   
  The function is filtering according to user's company (B) and cannot find the correct invoice sequence (which is assigned to A company). 
  As far as I understand multi-company, the filter should find a list of all children companies and give all sequences for A, B and NULL.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/789832/+subscriptions


Follow ups

References