Selection of multi-company products account in invoices lines

Bug #705043 reported by fooflare
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

version 6.0 on Ubuntu10.10 64bits

When you change the product in invoice line selects a view account not the subaccount where movements are registered. This problem is in multi-company, not in the default company installed with openerp. Position [0] in in_obj_acc has the view id of the company account, in position [1] the correct subaccount.

This code is in addons/account/invoice.py

lines 1359 to 1364

Actual code:

if in_acc or ex_acc:
   res.product_tmpl_id.property_account_income = in_obj_acc[0]
   res.product_tmpl_id.property_account_expense = exp_obj_acc[0]
else:
   res.categ_id.property_account_income_categ = in_obj_acc[0]
   res.categ_id.property_account_expense_categ = exp_obj_acc[0]

Proposed code:

if in_acc or ex_acc:
   res.product_tmpl_id.property_account_income = in_obj_acc[1]
   res.product_tmpl_id.property_account_expense = exp_obj_acc[1]
else:
   res.categ_id.property_account_income_categ = in_obj_acc[1]
   res.categ_id.property_account_expense_categ = exp_obj_acc[1]

Related branches

Revision history for this message
fooflare (fooflare) wrote :

I forgot to mention that my accounting location is Spanish but I think It affects any location. When I say subaccount I mean the internal type is Regular and when I say view, I mean internal type of account is View.

Thanks.

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Hello Amós,

As per your Bug Description, i checked the product and product category accounts. And we have already set domain on accounts where you can not select account with type=view and consolidation.

can you please provide more information ?

thanks,
mra

Changed in openobject-addons:
status: New → Incomplete
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
Revision history for this message
fooflare (fooflare) wrote :

Hello Mustafa,

The problem is not in Product Category or Product, I mean, I have by default correct accounts in both, this accounts are owned by the default company (Company A) that was created in the OpenERP installation. Now, in the invoice form, I create an invoice ant sets it to another company (Company B) different to the default company (Company A). After that I cretate an invoice line, select a product and the account is select automatically. The account selected is not the default one that we set in the Category or Product because is a different company, that is completly logical because i need the account of the new company. But the account that appears is the View one not the Regular (not in the select list, just in the field automatically). When I checked the values of the variables that i mentioned above, and the system was selecting the View ID value not the Regular ID of the account. The position [0] of the variables corresponds with the View ID account and [1] with the Regular one.

Something really important is that you can't reproduce it with the company that is created by default at the installation process of the database, we need a new company independent from the first activating with it the multi-company. That piece of code i wrote above to change is inside the conditional check of company_id.

Thanks

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Hello Amos,

There are some account charts where product category has property with income and expense account with wrong type (type=view).
So i confirm this bug and we correct all account charts such that property of the product and category accounts would be correct. Changing it to internal type=regular.

thanks,
mra

Changed in openobject-addons:
status: Incomplete → Confirmed
importance: Low → Medium
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Besides we have constraint on account.account as we must have type=view account if that account has children.
I mean if Account B is child of Account A then Account A must be with type=view.
can you tell us which chart you have installed ? I have tested with France charts and there is problem.

Changed in openobject-addons:
status: In Progress → Confirmed
Revision history for this message
fooflare (fooflare) wrote :

Hello Mustafa,

I use Spanish charts. But, the tree account in my case and the default income and expense accounts in category and product are corrects. My problem is not there, is just when i change the product in invoice line after changing the company in a multi-company enviroment, i reproduce it when i change the default company with another i have created after installation.

My steps are:

1. I create an invoice and change the default company with a new one that i created after installation (Its accounting has been configured correctly, i checked it)

2. I create an invoice line and select a product.

3. I check that the account that is selected by default with the product is not the Regular one, is a View.

When I checked the code, I saw that in the block where the company_id is been checked, the View and the Regular account are in in_obj_acc[0] (View) in_obj_acc[1] (Regular). The same case in exp_obj_acc. What i saw is the View account corresponds with Regular parent of the product (category) account. What I don't know is if I can have a solution in configuration without changing code and in that case how.

Thanks and regards

Revision history for this message
fooflare (fooflare) wrote :

Hello again :)

I have been thinking in what you wrote and i understand that you had assigned in category account the view instead of regular and maybe that is why the values I checked are in those positions, but my problem is that in Spanish chart accounts the tree seems to be well done. I have checked just now that in product category when i open list accounts i just can select the regular accounts and seems correct.

Sorry for the inconvenience and if you need more information tell me

Thanks again

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Hello Amos,

yes i checked for Spanish chart the product_onchage set account on invoice line with type=view instead of type=regular.

for e.g.
      70000 account code parent is 7000 account. it should take 70000 but it takes 7000 code.

We need to check/test it for all account charts doing wrong or not.

We will try to apply your patch and test for all account charts if its valid we will fix it :)

thank you very much.
mra

Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote :

Hello Amos,

Thanks for your contribution. It really help us. I have fixes the problem in
Revision No: 4626
Revision ID: <email address hidden>

Thanks

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.