← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 728560] Re: changing company currency breaks analytic account

 

The problem is that the currency_id field on account.analytic.account is not a real "related" field to the company's currency.
I think the reason why a normal m2o field was used is because it is sometimes needed to set the currency_id to None/False on the analytic account, to let it be shared between different companies. This would not be possible on a real related field.
(Strangely, the currency_id field is currently required, though???)

So what we need is a sort of related field that can be set to null.

In order to fix it, I propose do the following:

- replace the currency_id m2o field by a function field with store={
'res.company': ... } so that this function field is recomputed whenever
the company is modified (a proper reverse function is needed here)

- when computing the function field (fnct), it should:
  1. if currency_id is currently set to NULL in the database, do nothing and leave it like that.
  2. else, return the currency_id of the company this account belongs to.

- the setter function (fnct_inv) should:
  1. if False/None is being written, update the database with NULL and return
  2. if a value is written, check if it is the same as the current company currency
  3. if the value is the same as current company, ignore it.
  4. if a different value is being written raise an error saying "An analytic account's currency must be the same as the currency of its owner company, or empty."

For all questions, please discuss with Quentin de Paoli.

** Changed in: openobject-addons
   Importance: Undecided => Low

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

** Changed in: openobject-addons
    Milestone: None => 6.0.2

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 3 (openerp-dev-addons3)

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

Title:
  changing company currency breaks analytic account

Status in OpenERP Modules (addons):
  Confirmed

Bug description:
  In trunk,

  - create a db with "Project"
  - go to company to change the currency (Administration / Companies / Companies)
  - after changing of currency, go to analytic account  named "Project" and try to change something (for example, the name) (Acounting / Configuration / Analytic accounting / Analytic Accounts)

  -> bug

  (if you can not see such menu, check if the user has an access to
  useabilit / analytic account)



References