analytic_user_function KeyError: 'amount'

Bug #768968 reported by Stéphane Bidoul (Acsone)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

It seems the module analytic_user_function is not working as expected in the 6.0 branch.

module: analytic_user_function
branch: http://bazaar.launchpad.net/~openerp/openobject-addons/6.0/
revno: 4543

steps to reproduce:
- install modules analytic_user_function and account_analytic_plans with demo data
- open analytic account "OpenERP Integration"
- in tab Users/Products Rel, add a line (User=Fabian, Product=Service on Timesheet)
- create a timesheet for user Fabian
- add a timesheet line
- in the new timesheet line select Analytic Account "OpenERP Integration"
- tab to next field and you get the stack trace below

Environment Information :
System : Linux-2.6.35-28-generic-i686-with-Ubuntu-10.10-maverick
OS Name : posix
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick
Operating System Release : 2.6.35-28-generic
Operating System Version : #50-Ubuntu SMP Fri Mar 18 19:00:26 UTC 2011
Operating System Architecture : 32bit
Operating System Locale : fr_BE.UTF8
Python Version : 2.6.6
OpenERP-Client Version : 6.0.2
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/stephane/Build/openerp6-python/lib/python2.6/site-packages/openerp-server/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/stephane/Build/openerp6-python/lib/python2.6/site-packages/openerp-server/service/web_services.py", line 599, in dispatch
    res = fn(db, uid, *params)
  File "/home/stephane/Build/openerp6-python/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/stephane/Build/openerp6-python/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/stephane/Build/openerp6-python/lib/python2.6/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/stephane/Build/openerp6/addons/analytic_user_function/analytic_user_function.py", line 102, in on_change_account_id
    r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount']
KeyError: 'amount'

Related branches

Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello,

I have fixed it in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-768968-pso
Rev-Id: <email address hidden>
Rev-no: 4664

It will be merged soon with Addons branch.

Thanks for reporting.

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Will it be backported to the 6.0 series?

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

Hello,

This fixes will only back port when you have a Maintenance case with OPW team. So the OPW team will back port the changes from trunk to stable.
Otherwise from next minor release the fixes code will be available to main stable 6.0 branch.

Thanks.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

I understand.

Thanks for the fix.

qdp (OpenERP) (qdp)
Changed in openobject-addons:
status: Fix Committed → Fix Released
Revision history for this message
Bogdan Stanciu (bstanciu) wrote : Re: [Bug 768968] Re: analytic_user_function KeyError: 'amount'

On 03. 05. 11 11:18, qdp (OpenERP) wrote:
> ** Changed in: openobject-addons
> Status: Fix Committed => Fix Released
>
hi there,

I see that some rounding is hard-coded in at lest 2 places. Wouldn't it
be better to have a dp function instead? just wondering...

here the line:

+ res ['value']['amount']= - round(amount, 2)

thank you,
b

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.