There are lots of examples of this in the code. It was OK when things weren't multicompany but it probably needs wider addressing and correcting for 6.1. There are many related and reported bugs to this one. And the thing in common is returning the first search result, when the user has multicompany access and is working with a company that was not created first.
As examples, Balance Sheet and P &L wizards return first entries, which often mismatch periods, charts and fiscals if the user has access to more than one company. The crazy thing is that the default functions for those wizards all handle getting their defaults so differently that all the defaults in my setup actually belong to 3 different companies. What makes it harder, is that these default values (most often journals, and periods, sometimes fiscal years), selection widgets all refer to entries with the same name. e.g. period names are identical, journal names are identical, journal codes are identical, fiscal years are identical making it very very hard for the user to tell what is going on. In my module account_account_extension_o4sb I rewrote many of those functions to return sensible defaults, and also updated the configuration wizard to differentiate on names for journals. I think the greek localisation module has done other related improvements On Mon, Jul 4, 2011 at 10:24 AM, Eric Caudal - www.elico-corp.com < [email protected]> wrote: > Yes, the user is in the same company as the PO. > It depends on the order in which you create the periods in database. for > example: create first the periods for company A in the database (then B) > and try to receive an incoming shipment for company B > _get_periods gives you the first period id it finds in the table. > > Eric CAUDAL > [email protected] <mailto:[email protected]> > Cell phone: + 86 186 2136 1670 > > Elico Corp, Shanghai > OpenERP Ready Partner > http://www.elico-corp.com > > > On 04/07/2011 04:44, Kevin McMenamin wrote: > > I have tried on 6.0.02 and works fine - are you sure that the company > > under user/preferences was the same as the PO you were receipting? > > > > -- > You received this bug notification because you are subscribed to OpenERP > Addons. > https://bugs.launchpad.net/bugs/804991 > > Title: > Cant process picking in multi-company environment > > Status in OpenERP Modules (addons): > New > > Bug description: > In 6.02 > With 2 companies A and B, 2 charts of account and 2 periods set, one for > each company. > Creating a purchase order and then I try to process the "incoming > shipment". > When click in "Process", then in subform in "Validate" I receive the > following message: > Error occurred while validating the field(s) company_id: Company must be > same for its related account and period. > > This is due to the fact that no periods are passed in > stock_partial_move.do_partial() > And then in account._get_period(), all periods are returned and the first > period is chosen instead of chosing the one corresponding to the user. > Maybe change in _get_period() > periods = self.pool.get('account.period').find(cr, uid) > and add a filter according to the user > > To manage notifications about this bug go to: > https://bugs.launchpad.net/openobject-addons/+bug/804991/+subscriptions > -- 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/804991 Title: Cant process picking in multi-company environment Status in OpenERP Modules (addons): New Bug description: In 6.02 With 2 companies A and B, 2 charts of account and 2 periods set, one for each company. Creating a purchase order and then I try to process the "incoming shipment". When click in "Process", then in subform in "Validate" I receive the following message: Error occurred while validating the field(s) company_id: Company must be same for its related account and period. This is due to the fact that no periods are passed in stock_partial_move.do_partial() And then in account._get_period(), all periods are returned and the first period is chosen instead of chosing the one corresponding to the user. Maybe change in _get_period() periods = self.pool.get('account.period').find(cr, uid) and add a filter according to the user To manage notifications about this bug go to: https://bugs.launchpad.net/openobject-addons/+bug/804991/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~c2c-oerpscenario Post to : [email protected] Unsubscribe : https://launchpad.net/~c2c-oerpscenario More help : https://help.launchpad.net/ListHelp

