Price.type currency isn't taken into computation #analytic #accounting : this is quite dangerous. Cost = 50EUR -> If company CHF => 50CHF :(

Bug #704469 reported by Joël Grand-Guillaume @ camptocamp
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Low
OpenERP R&D Addons Team 3

Bug Description

Hi,

Given :

- My company is in CHF
- My price.type is in EUR
- I record an analytic line with any product (ex: cost 30, which is supposed to be in EUR)

I should have an Amount in the analytic line = 30 EUR * RATE ~= 45 CHF !!!

This is quite important in multi-company context. Thanks to have a look.

Little helps:

In the on_change_unit_amount of analytic_line, you should give the currency in the context of price_get function:

context['currency_id']=company_obj.browse(cr,uid,company_id).currency_id.id
amount_unit = prod.price_get(pricetype.field, context=ctx)[prod.id]

Regards,

Joël

Tags: invoicing

Related branches

affects: account-banking → openobject-addons
Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hello Joel,

i'm sorry but i don't understand how you're having that bug to occur: if i'm making an invoice in € and my company currency is in CHF, it will create analytic lines in CHF with the good amount as expected. I don't understand this price.type you're talking about, it seems to me it is some rest of deprecated code we reverted some time ago...

but anyway, tahnks for the contribution ;-)
Quentin

Changed in openobject-addons:
status: New → Invalid
Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Joel do you refer price.type for pricelist.type? , its has currency_id but was removed from code.

Regards,

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Ok, may be I need to put more infos here to let you understand sorry. First, I will make it open again cause this is a real bug. Here are the infos:

- The referred object is 'price_type' from pricelist.py and is still widely used if I don't miss something... At least in price lists, but should also be used in the analytic accounting IMHO.

- No menu exists anymore for this object (price.type), I had to create one.

- In invoices it is ok cause the invoice handle this for us, so no problem here.

The problematic:

A price type define which float field of the product represent a price, and in which currency this price is expressed. This is used into price list and should convert the currency according to that infos (not the company currency for example).

By default OpenERP set the same currency for company and price.type, so with a standard config, not problem. But when you have a company in EUR and prices expressed in USD, so the troubles starts !

Let make this:

- Company EUR
- Price type Standard price CHF
- Make one analytic line (from timesheet or by encoding it manualy) with a product where standard price = 40 (which is supposed to be CHF).

=> The result is an analytic line with amount = 40. This amount is in EUR cause the company is in EUR and this is not the right value, I expect to have 40 * Rate = ~30

This is also true in the stock accounting by the way ! And here you let the code I had made some 5 month ago. So please, consider this seriously.

The price.type must be taken into account everywhere or nowhere (so it means, remove it !).

Thanks to have a closer look,

Regards,

Joël

Changed in openobject-addons:
status: Invalid → New
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Just a little things more. I think just adding the currency (in context) in which you want the result in the on_change_unit_amount of analytic_line, should give the right result :

context['currency_id']=company_obj.browse(cr,uid,company_id).currency_id.id
amount_unit = prod.price_get(pricetype.field, context=ctx)[prod.id]

This trouble comes, as you said Quentin, cause you remove my code (with full support of multi-currency / multi-comapny in analytic accounting). But you let some parts... without lots of testing I think :(

Amit Parik (amit-parik)
Changed in openobject-addons:
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → Low
Amit Parik (amit-parik)
tags: added: invoicing
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Sunil Sharma(OpenERP) (sunil.sharma-openerp) wrote :

Hello,

It has been Fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-704469-ssh

revision-id: 9029

revno: <email address hidden>

It will be available in trunk soon.

Changed in openobject-addons:
status: In Progress → Fix Committed
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.