← Back to team overview

openerp-india team mailing list archive

[Bug 1051470] Re: [7.0 trunk] Problem with Settings - Configuration - Accounting

 

I am still seeing this problem so have debugged it to a point. (Module
account/res_config.py)

What I have found is that when you save the Accounting Settings, (with a
chart already installed, and fiscal years already created), the
following sequence of things happen when you hit the 'Apply" button:

1. A new account_config_settings record gets created.  (Why does it not
just update the existing one??)  The date_start and date_stop values get
initialised with defaults which are 1/1 and 31/12 of current year. No
reference to previous values contained in the existing config record???

2. Method set_fiscalyear gets called. This method looks to see if there
is fiscal years in existence that starts earlier than the date_start in
the new config record, AND finishes later than the date_stop. However
this test is erroneous if fiscal years based on Jul to Jun have been set
up. So the test fails, and system then tries to (erroneously) create a
new fiscal year, which it should not. No test is made of the attribute
"has_fiscal_year" which is the better test that it should be performing.

Hence I altered the line in method set_fiscalyear,

From:
        if config.has_chart_of_accounts or config.chart_template_id:

To:

        if not config.has_fiscal_year and (config.has_chart_of_accounts
or config.chart_template_id):

I'm not sure whether the rest of this logic really is correct, but at
least by wrapping it in this additional test this resolved the
problem....if the fiscal year already exists in accordance with the
attribute in the config record, then there is no need to try creating
another one.  (By the way, the code that initialises the value of
has_fiscal_year is different from the tests above, and produces more
sensible results to the question of "is there a fiscal year in existence
that encompasses the current date".


** Changed in: openobject-addons
       Status: Invalid => Incomplete

** Changed in: openobject-addons
       Status: Incomplete => New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1051470

Title:
  [7.0 trunk] Problem with Settings - Configuration - Accounting

Status in OpenERP Addons (modules):
  New

Bug description:
  Probably a long-standing issue...

  The module res_cofig.py in account module has a method set_fiscalyear,
  which creates a fiscal year for a company if necessary. The method
  gets called when the settings config form is edited (even if no
  setting is changed).

  The problem is that this code may blow up if the financial year and
  periods were not created as part of a chart install process, i.e.
  created manually after the fact. (i.e. there are residual values in
  account_config_settings table which aren't actually consistent with
  the year that was created manually)

  Consequence is that the method tries to create a financial year (with
  potentially different start and end dates) that already exists in the
  database, and throws an exception.

  I can't see why this method should be called during an update to
  general config settings for accounts. It should really only happen at
  chart installation time.

  Steos to reproduce:
  1. Fresh DB
  2. Install a chart, but cancel the creation of periods at that point.
  3. Go into Accounting/Config/Periods and create a year 2012 (with periods running from Jul 1, 2011 to Jun 30, 2012)
  4. Check values in account_config_settings tabe for start and end date, verify they are different from (3).
  5. Try and update settings in Settings/Configuration/Accounting... you should get an exception.

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


References