← Back to team overview

credativ team mailing list archive

[Bug 900266] [NEW] on_change_product search for the property id instead of account_id

 

Public bug reported:

Hello,

In addons/account/invoice.py, you'll see this lines (1345):
    app_acc_exp = account_obj.browse(cr, uid, exp_pro_id, context=context)[0]
But, if you search at exp_pro_id, you'll see that it is define in line 1319:

    exp_pro_id = property_obj.search(cr, uid,
[('name','=','property_account_expense'),
'res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])

or 1321:

    exp_pro_id = property_obj.search(cr, uid,
[('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])

exp_pro_id is the id of a property (table ir.property), not of an
account. This causes errors.

To resolve the problem, you should use the same function that the in
account.

     # Get the fields from the ir.property record
     my_value = property_obj.read(cr,uid,in_pro_id,['name','value_reference','res_id'])
     # Parse the value_reference field to get the ID of the account.account record
     account_id = int (my_value[0]["value_reference"].split(",")[1])

I use OpenERP 6.0.3 (the release we can download from the download page
in the openerp website)

** Affects: openobject-addons
     Importance: Undecided
         Status: New

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

Title:
  on_change_product search for the property id instead of account_id

Status in OpenERP Addons (modules):
  New

Bug description:
  Hello,

  In addons/account/invoice.py, you'll see this lines (1345):
      app_acc_exp = account_obj.browse(cr, uid, exp_pro_id, context=context)[0]
  But, if you search at exp_pro_id, you'll see that it is define in line 1319:

      exp_pro_id = property_obj.search(cr, uid,
  [('name','=','property_account_expense'),
  'res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])

  or 1321:

      exp_pro_id = property_obj.search(cr, uid,
  [('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])

  exp_pro_id is the id of a property (table ir.property), not of an
  account. This causes errors.

  To resolve the problem, you should use the same function that the in
  account.

       # Get the fields from the ir.property record
       my_value = property_obj.read(cr,uid,in_pro_id,['name','value_reference','res_id'])
       # Parse the value_reference field to get the ID of the account.account record
       account_id = int (my_value[0]["value_reference"].split(",")[1])

  I use OpenERP 6.0.3 (the release we can download from the download
  page in the openerp website)

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


Follow ups

References