← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 809558] [NEW] Account voucher multi-company

 

This is definitely a bug.  And it is blocking as period_id is a hidden field
on that form.

    def _get_period(self, cr, uid, context=None):
        if context is None: context = {}
        if context.get('period_id', False):
            return context.get('period_id')
        periods = self.pool.get('account.period').find(cr, uid)
        return periods and periods[0] or False

    def onchange_date(self, cr, uid, ids, partner_id, journal_id, price,
currency_id, ttype, date, context=None):
        """
        @param date: latest value from user input for field date
        @param args: other arguments
        @param context: context arguments, like lang, time zone
        @return: Returns a dict which contains new values, and context
        """
        period_pool = self.pool.get('account.period')
        res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id,
price, currency_id, ttype, date, context=context)
        pids = period_pool.search(cr, uid, [('date_start', '<=', date),
('date_stop', '>=', date)])
        if pids:
            if not 'value' in res:
                res['value'] = {}
            res['value'].update({'period_id':pids[0]})
        return res

Is the problematic code - all these default and on_change functions need
reviewing.  It is incorrect to simply return the first value and assume it
is correct.  See bug 804991 for another example.

I recommend at the least in onchange_date passing company_id field and then
changing
pids = period_pool.search(cr, uid, [('date_start', '<=', date),
('date_stop', '>=', date), ('company_id', '=', company_id])  (Note not
tested, consider it pseudo code maybe company_id.id required there.)


On Wed, Jul 13, 2011 at 9:00 AM, Kevin McMenamin
<809558@xxxxxxxxxxxxxxxxxx>wrote:

> Public bug reported:
>
> I have created a multi-company environment with holding coy (HoldCoy) and
> two subsidiaries A & B.
> I have created 3 new users - No1 has Holdcoy as default coy with access to
> other 2, other 2 users have access to either A or B.
> I have created a customer with no company value in Sales and Purchases tab
> I have created three new journals (one per company) for debtor adjustments.
>
> When I process a debtor adjustment using journal voucher for either A or B
> it works fine.
> When I process for No1 in Holdcoy I get a conmpanyID error - Company must
> be same for its related account and period.
> I have checked partner not linked to another company, user preference coy =
> journal coy = company = company for GL account.
> The only field I cannot check is the default type field - this is a defined
> list. Is there anything company specific about this field (the account value
> generated under voucher items is for the correct company).
>
> Any ideas or is this a bug?
>
> Thanks
> Kevin
>
> ** Affects: openobject-addons
>     Importance: Undecided
>         Status: New
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Addons.
> https://bugs.launchpad.net/bugs/809558
>
> Title:
>  Account voucher multi-company
>
> Status in OpenERP Modules (addons):
>  New
>
> Bug description:
>  I have created a multi-company environment with holding coy (HoldCoy) and
> two subsidiaries A & B.
>  I have created 3 new users - No1 has Holdcoy as default coy with access to
> other 2, other 2 users have access to either A or B.
>  I have created a customer with no company value in Sales and Purchases tab
>  I have created three new journals (one per company) for debtor
> adjustments.
>
>  When I process a debtor adjustment using journal voucher for either A or B
> it works fine.
>  When I process for No1 in Holdcoy I get a conmpanyID error - Company must
> be same for its related account and period.
>  I have checked partner not linked to another company, user preference coy
> = journal coy = company = company for GL account.
>  The only field I cannot check is the default type field - this is a
> defined list. Is there anything company specific about this field (the
> account value generated under voucher items is for the correct company).
>
>  Any ideas or is this a bug?
>
>  Thanks
>  Kevin
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-addons/+bug/809558/+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/809558

Title:
  Account voucher multi-company

Status in OpenERP Modules (addons):
  New

Bug description:
  I have created a multi-company environment with holding coy (HoldCoy) and two subsidiaries A & B.
  I have created 3 new users - No1 has Holdcoy as default coy with access to other 2, other 2 users have access to either A or B.
  I have created a customer with no company value in Sales and Purchases tab
  I have created three new journals (one per company) for debtor adjustments.

  When I process a debtor adjustment using journal voucher for either A or B it works fine.
  When I process for No1 in Holdcoy I get a conmpanyID error - Company must be same for its related account and period.
  I have checked partner not linked to another company, user preference coy = journal coy = company = company for GL account.
  The only field I cannot check is the default type field - this is a defined list. Is there anything company specific about this field (the account value generated under voucher items is for the correct company).

  Any ideas or is this a bug?

  Thanks
  Kevin

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


References