← Back to team overview

openerp-expert-accounting team mailing list archive

[Bug 381910] Re: account_asset: incorrect calculation of asset depreciation amount

 

HOLA COMUNIDAD:

Me sucede el siguiente problema al querer guardar un registro en la base
de datos, ya estuve viendo en postgres y no me genera las columnas
x_placa, x_marca en la tabla modulo_autos:

Environment Information : 
System : Windows-XP-5.1.2600-SP2
OS Name : nt
Operating System Release : XP
Operating System Version : 5.1.2600
Operating System Architecture : 32bit
Operating System Locale : es_CO.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.10
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "netsvc.pyo", line 245, in dispatch
  File "netsvc.pyo", line 74, in __call__
  File "service\web_services.pyo", line 576, in execute
  File "osv\osv.pyo", line 58, in wrapper
  File "osv\osv.pyo", line 119, in execute
  File "osv\osv.pyo", line 111, in execute_cr
  File "osv\orm.pyo", line 2842, in create
  File "sql_db.pyo", line 77, in wrapper
  File "sql_db.pyo", line 122, in execute
ProgrammingError: column "x_modelo" of relation "modulo_autos" does not exist
LINE 1: insert into "modulo_autos" (id,"x_modelo","x_marca","x_placa...

Este es el codigo PYTHON:

from osv import osv, fields


class modulo_autos(osv.osv):
	_name = 'modulo.autos'
	_auto = 'False'
	_columns = { 
		'x_placa': fields.char('PLACA', size=20),
		'x_marca': fields.char('MARCA', size=10),
		'x_modelo': fields.char('MODELO', size=10),
		}
modulo_autos()


y el codigo XML:

<terp>
<data>
<record model="ir.ui.view" id="view_modulo_autos_form">
<field name="name">modulo.autos.form</field>
<field name="model">modulo.autos</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="modulo.autos">
	<!--<field name="assumpte" select="1">-->
	<field name="x_placa" required="1"/>
	<field name="x_marca"/>
	<field name="x_modelo"/>
	

<!--</field>-->
</form>
</field>
</record>

<record model="ir.ui.view" id="view_modulo_autos_tree">
<field name="name">vehiculos.tree</field>
<field name="model">modulo.autos</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="modulo.autos">
<!--<field name="assumpte">-->
	<field name="x_placa" required="1"/>
	<field name="x_marca"/>
	<field name="x_modelo"/>


<!--</field>-->
</tree>

</field>
</record>

<record model="ir.actions.act_window" id="action_modulo_autos">
<field name="name">modulo.autos</field>
<field name="res_model">modulo.autos</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

</record>

<menuitem name="GESTION VEHICULOS/Inventario/nuevo_auto"
id="menu_modulo_autos" action="action_modulo_autos"></menuitem>


</data>
</terp>

No encuentro la solucion a este problema gracias de antemano.
                                       ^

-- 
account_asset: incorrect calculation of asset depreciation amount
https://bugs.launchpad.net/bugs/381910
You received this bug notification because you are a member of OpenERP
Accounting Experts, which is a direct subscriber.

Status in OpenObject Addons Modules: Invalid

Bug description:
The function Financial Management/Periodical Processing/Compute assets calculate asset depreciation amount incorrectly: instead of subtracting already-depreciated amounts before calculating amount for 2nd, 3rd etc months, the algorithm adds already-depreciated amounts to asset cost.

For example,
 Asset 1 costs $1000
 Depreciation method is progressive - 15% per period
For first period the algorithm create an account move in $150.
For second period the algorithm creates a move in $172.5 (10% from $1000 + $150)

After short investigation I've found a bug in the file account_asset.py in line 118:

is
114        for move in property.asset_id.entry_ids:
115            total += move.debit-move.credit
116        for move in property.entry_asset_ids:
117            if move.account_id == property.account_asset_ids:
118                total += move.debit-move.credit

should be
114        for move in property.asset_id.entry_ids:
115            total += move.debit-move.credit
116        for move in property.entry_asset_ids:
117            if move.account_id == property.account_asset_ids:
118                total -= move.debit-move.credit

Regards,
Michael