account_asset: incorrect calculation of asset depreciation amount

Asked by mfl

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

Question information

Language:
English Edit question
Status:
Open
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#1

I have different behaviour in 5.0.6 (also wrong).

I created 2 Products with cost 100EUR, first assigned to linear method asset (5 intervals -> 20%), second to progressive (30%).
And run "Compute Assets".

For linear method I got depreciation 20EUR but Residual 60 (should be 100-20=80).
For progressive method I got depreciation 30 but residual 40 (should be 100-30=70)

It looks that depreciation is counted twice for residual.
And for progressive account sides are wrong. Depreciation should Debit and Fixed assets should be Credit (is opposite). In linear is correct.

And finally I am not able to run "Compute Assets" any more. I tested few times creating fresh database. Every second time I got:
Environment Information :
System : Linux-2.6.28-15-generic-i686-with-Ubuntu-9.04-jaunty
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty
Operating System Release : 2.6.28-15-generic
Operating System Version : #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : pl_PL.UTF8
Python Version : 2.5.4
OpenERP-Client Version : 5.0.6
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 639, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 619, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 74, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account_asset.zip/account_asset/wizard/wizard_asset_compute.py", line 52, in _asset_compute
    ids_create += ass_obj._compute_entries(cr, uid, asset, data['form']['period_id'], context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account_asset.zip/account_asset/account_asset.py", line 172, in _compute_entries
    period = self._compute_period(cr, uid, property, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account_asset.zip/account_asset/account_asset.py", line 105, in _compute_period
    current_period = self.pool.get('account.period').browse(cr, uid, cpid, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 436, in browse
    return browse_record(cr, uid, select, self, cache, context=context, list_class=self._list_class, fields_process=fields_process)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 146, in __init__
    raise BrowseRecordError(_('Wrong ID for the browse record, got %r, expected an integer.') % (id,))
BrowseRecordError: Wrong ID for the browse record, got False, expected an integer.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#2

Hello, is anybody working on that? (account_asset)
I don't belong to openerp-expert-accounting. So I couldn't get any information even if it is some progress. I am going to apply to this group yet.

I have made some basic fixes for this module (not published yet):
- Residual is calculated correctly.
- Correct period assigning to accounting posts is fixed.
- Some codding bugs for linear and progressive method are fixed.

So I think module got basic usability. I will publish it in separate branch and will wait for some testing, wishlists and so on.

So I have some question to finish current functionality:

1. Do you know how "Depr. method type" [Direct, Indirect] should work? It is not implemented in code at all.
2. Do you know how "Time method" [Delay, Ending period] should work? It is not implemented in code at all.
3. Do you know how "Close method" button should work? It is not implemented in code.

And please make opinion to my ideas to improve this module:
4. I want to add another method needed in PL named "Degressive". Will work similar to Progressive but period depreciations will be equal across each year (as 12 months). Should I add such functionality to this module or it should be a part of future separate PL localization module (localization project)? I prefer to add it to current module because: a). maybe some other country will use it, b). I and anyone else will be interested to improve this module in general (otherwise I would prefere to improve separate module only).

5. I want add "Asset Category" selection in "Compute Assets" wizard. Otherwise it is no functionality for Asset category.
6. Do you think it should be a list of selected assets in "Compute Assets" BEFORE computing and posting with possibility to cancel whole action or cancel some assets from that calculation?

Please add your opinions or wishlists. I will try make this module usable. We can continue on openerp-expert-accounting maillist when I am approved but this bug tread will be more convenient I think.
Grzegorz

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#3

No opinions? No suggestions? No wishes ? ..... No problem!

I will apply my fixes to stable and trunk.

Then I will add my depreciation method and I will add Asset category to Compute Assets. Point 6 I will left for later on.

Revision history for this message
Ferdinand (office-chricar) said :
#4

AFAIK the asset module was more a proof of concept then production ready.

IMHO we should set up specs for asset depreciation computation.
* IRFS
* national rules
* fiscal values

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

Hi Grzegorz,

Thanks for your corrections. I'm aware this module was just a proof of concept at the beginning. We make it with Fabien and Luc Maurer in 2 days, so ,...

At the end Fabien wanted to release it into addons, and so it is...

I think your corrections are very welcome as nobody does them :) !! Just suggest a merge proposal for your corrections, I'll try to validate them if I found some time.

Thanks for your contributions,

Joël

Revision history for this message
Samuel I. (Toradex) (samsimg) said :
#6

I'm not sure if this is the right place to ask...

It would be really nice if the account_asset module would support multi-company. So if someone touches this module, it would be very nice to consider that :-)

Thanks,

Samuel

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#7

I think I have finished fixing linear, progressive and new degressive counting method. I will add some user guide in description, more helps, I will try to find what to do for close method button, and I will add some smaller functionality improvement. So it is still in progress.

Samuel: thank you for reminding. But after quick consideration I think I will add multicompany functionality to account_asset in trunk 5.2 version. Of course I can add company_id fields to asset tables but account_move or account_move_line tables doesn't contain this field in standard. I evaluate that it would be to complicated to check if multicomapny modules exist or not. For 5.2 it will be evident and I promise to do it.

Ferdinand: I think I am to weak in accounting to study IRFS. I know that apart of buying we can have assets coming from production or equity. So it is a lot of functionality to add. I have added one of our national method. (We use linear and degressive).

Joel: for few weeks I am commiter so I can push module back to extra branch. I will inform you and you decide if it is worth to transfer it to addons.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#8

What a surprise: my local method which I have transcripted to english as "degressive" in US and UK docs is named Declining-balance and it looks it is used widely. So I have changed the name to Declining Balance. I have also added Salvage value (residual not counted in depreciation). I added Close functionality.

I see that I could optimise code and make same changes to turn module to more smart but I am afraid I cannot understand first author intention. In current functionality one asset can have few depreciation methods. Why? Is it really needed?

When I read accounting docs it looks it should be more asset operations implemented. But I don't feel to be able to implement them. I have too little knowledge and experience for further developing. Simple solution could be to allow manually editing the entries in assets for other operations but I am not sure if it is too dangerous.

So I will make some more testing, apearance changes, more texts and helps and will finish improvement.

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#9

Grzegorz, can you send me your 'fixed' account_asset version?

I have just been testing the account_asset module to see if it was valid for Spain, and found that it should display a big "work in progress!" poster :(

The main ideas of the module seem right, but most options are not implemented or don't work propertly! (you seem to have fixed some of them).

I'll send some info about how assets are managed on Spain to the OpenERP's Accounting Experts group.

But, now, some answers:

> 1. Do you know how "Depr. method type" [Direct, Indirect] should work? It is not implemented in code at all.
I think I do:
* Direct => Just as it currently is doing: The depreciation is computed against the asset account. The residual value of the asset is directly the value of its asset account.
* Indirect => Just as needed on Spain: The depreciation is computed against an expenses account (the asset account remains untouched). The residual value of the asset is the value of its asset account minus the value of its depreciation account.

> 2. Do you know how "Time method" [Delay, Ending period] should work? It is not implemented in code at all.

Again I think I do:
* With "Delay" method, the amortization should be done after the a given period of time,
* With "Ending period" it should be done on the last day of the fiscal year

For example you bought an asset on September with a yearly amortization and a life expectancy of 5 years:
* Delay: On some countries you may amortize it on the same day of September of the next year (and September of the next years). Every year you would
* Ending: On other countries (like Spain) you must amortize it on the 31th of December of the same year, and on every 31th of December after that date.

> 3. Do you know how "Close method" button should work? It is not implemented in code.

Maybe it was intended to mark the asset as 'no longer active/valid'. I mean, imagine that your asset is a car and you sell it: You no longer want to see it within your 'current' assets, nor you need to calculate it's depreciation.

> 4. I want to add another method needed in PL named "Degressive". Will work similar to Progressive but period depreciations will be equal across each year (as 12 months). Should I add such functionality to this module or it should be a part of future separate PL localization module (localization project)? I prefer to add it to current module because: a). maybe some other country will use it, b). I and anyone else will be interested to improve this module in general (otherwise I would prefere to improve separate module only).

That method is one of the used on Spain. So I think it should be implemented on the base.

We currently have four methods (though I think only the first two are widely used):
- "Método lineal o de cuotas fijas" => "Linear method or with fixed amounts" Similar to your degresive method (same quantity each year). Note: On Spain there are (very detailed) tables with the legal values to use on this method for each kind of asset (max amortization period, max quantity to amortize per period).
- "Método del tanto fijo sobre una base amortizable decreciente" => "Method of the fixed percent over an decreasing amortizable quantity" => Same percent every year
- "Método de los números dígitos" => "Method of the digit numbers" => You pay a diferent quantity based on the number of the year (for example if the asset has a life expectancy of six years you might amortize 6000, 5000, 4000... 1000 each of the years; or 1000, 2000, ..., 6000)
- "Método de la cuota de amortización constante por unidad de productos elaborada" => "Method of the fixed amortization amount by unit of product made" => Used for machinery that makes goods (imagine that you need to change it every 10000 items), you calculate how many goods you expect to create with that machine over its full life, and each year you amortize an amount proportional to the goods created that year.

> 5. I want add "Asset Category" selection in "Compute Assets" wizard. Otherwise it is no functionality for Asset category.

Good idea.

> 6. Do you think it should be a list of selected assets in "Compute Assets" BEFORE computing and posting with possibility to cancel whole action or cancel some assets from that calculation?

I think we should show use a form with a many2many widget to let the user select the assets he wants to compute.
It would then 'precalculate' the assets and show the user a preview of the calculated values for the assets (show the future value, residual value, amortization/depreciation quantity...); and only when the user has confirmed this screen, create the accounting entries and update the real asset values.

> In current functionality one asset can have few depreciation methods. Why? Is it really needed?

On Spain we can only have a single 'accounting amortization/depreciation method' like you would expect; but... we have a 'fiscal amortization/depreciation method' too!
Maybe the original author was trying to implement something like this.

You may now be thinking: 'fiscal amortization method... WTF!'

The accounting amortization method is the one used on the company accounting to track the value of its assets.
The fiscal amortization method is the one used to calculate the taxes you have to pay based on your yearly profit.

I don't really understand this mess (I'm not accountant) but it seems that sometimes is more interesting to amortize sooner an asset on the fiscal side, to declare less benefits that fiscal year, and so you have to pay less taxes... but on the accounting side you may want to amortize it on a longer term (based on its real life expectancy) so you know the real value of the assets... Nasty, isn't it?

So yes: On Spain we may need more than one amortization methods, cause the asset may have one value on the fiscal side and another value on the accounting side, but not all the amortization methods may create accounting entries!

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#10

Hello, My module is in branch related to this bugreport. I have hidden unknown and not working options. But options are still in code to revert them.

Current module is not working. Both methods have bugs. And I saw more bugs in code.

I think I finished all I wanted to do. I am about to merge it back to extra-5.0.

I am only waiting for opinions like yours, and considering how to play with POT and PO files, to not loose current translation. I see Spanish and Catalonian PO files. I know how to create POT file and PO file. I have added some texts to code and I think I should create new POT, but I am not sure what should I do with PO files to just expand them not loosing current translation. And I don't know how web Launchpad interface react for such changes.

I know language files should be made at the end so am I delaying with it as I have some other work at the moment.

I will read your suggestions and get back to this thread.

But I want to tell that I don't feel to strong in accounting and after my contribution (merging back to extra-5.0) I want to forward the further work to someone else with a pleasure.
All the best.

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#11

Thanks Grzegorz.

About the POT and PO files, this is what you need to do:

On OpenERP go to Administration -> Translations -> Export a translation

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#12

(Sorry, I sent half a comment)

Thanks Grzegorz, I'll give it a look when I have some time :)

About the POT and PO files, this is what you need to do:

On OpenERP go to Administration -> Translations -> Import / Export -> Export a Translation File

Select English as language, "PO file" as file format and add the account_asset module to the list. Save the generated file as the POT file (overwrite the current account_asset.pot).

That's enough for now.

When you push that modified POT file to Launchpad, it will detect the changes and add the new (still untranslated) terms to the other "<language>.po" files, and make available those terms on the Launchpad translation tool (take a look here: https://translations.launchpad.net/openobject-addons).

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#13

Hello, Borja:

Thank you for clarifying unknown (to me) options.
=====================================
Regarding "Depr. method type" (Direct, Indirect).

 In Poland we also use indirect method. But this method is available now in current functionality. It looks like "breaking" method but it works. When you create asset you can select the "expense" account in field "Asset account". Then when you assigning the asset to product in invoice line (when creating invoice) you select the Asset account in Account field in Invoice Line. Then everything works as in indirect method. To have direct method you should select Asset account in Asset account field in asset and the same Asset account in Invoice line Account.

To implement the method selection in smart way we should have in Asset module three accounts (all mandatory):
- Asset account
- Expense account
- Deprecation account

In such case we don't even need method selection. User can simply enter the same account into Asset account and Expense account field when method is direct. But we should aid the user in Asset account selection in invoice. I mean when user selects asset in invoice line Asset account should be automatically copied to invoice line from Asset settings and maybe change to readonly.

But such improvement is not a "must" as I said we can use both methods now. I can rename "Asset Account" to "Expense/Asset Account" and make guidance in module description.
=================================================
Regarding "Time method" [Delay, Ending period]
Now after my improvement it is mixed. My added method correctly named now "Declining-Balance" is implemented with year sensivity. I mean whatever period and interval settings you choose it is recalculated "to the end of year" and "from beginning of year". I think it is a nature of this method. I didn't find any other description even in english sources. Other methods maybe needs some implementation adjusting that when they have year interval they should be performed at the end of calendar year not after 12 months. In Poland we use (I am almost sure as not too big expert) monthly depreciation so we don't need "ending period" method. So I will never feel how should it be implemented and I will leave it to someone else.
=======================================
Regarding Close button:
I have just marked asset as closed so it leaves with current depreciation and current residual. It will not be calculated as asset any more.
====================
Regarding New polish method:
As I already written it is not "Digressive" any more. According to english sources it is Declining-Balance method which is probably used widely in the world. The power of method can be adjusted with Progressive factor value. So when you want to use it as Double Declining Balance you should set proper Progressive factor. I think that this way you can adopt any depreciation tables.
======================
Regarding Asset category
I have added Asset category selection to Compute Assets window.
=============================
Regarding Precalculation feature
I have resigned to implement it by now as too complicated at the moment.
===========================
Regarding several methods for one asset.
We don't use fiscal depreciation and I don't feel

====
Borja thank you for POT file indication.
I will wait for some bug reports of my branch. If it is no errors I will made some text, help and description improvement yet, I will create new POT file and push the branch back to extra-5.0.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#14

Sorry for text cut. It should be:
===========================
Regarding several methods for one asset.
I understand the potential purpose of it. We don't use fiscal depreciation and I don't feel to be right person to implement this or take part in discussion of it.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#15

I am going to improve the module farther.

I will implement Depr. Method Type as I explained in this thraed.

After reading
http://accounting-financial-tax.com/2009/04/how-to-calculate-and-record-depreciation-of-fixed-asset/
I feel I should implement other methods of depreciations:

So I am about to add "Sum of Year Digits" method.
I am thinking about "Unit of Production" method (real usage of asset). Does anybody use it?
Please advise if current Progressive method is really needed. I didn't find any mention in docs and in web about such method. It looks it is rather test for module not real depreciation method.

I also will implement Time method. But it seems that it should concerns only yearly depreciations. So it should be named "Time Method [Interval, End of Year]". And when "end of year" is chosen periods and intervals are ignored. And depreciation for first year will counted from starting period (set in asset) to the end of year. Then it will be full yearly depreciation. If user choose Interval depreciation it will be counted as now. Is it OK?

And I am thinking how to allow some other operations on assets like: revaluation, Defining assets other way than purchasing. And I am still thinking about manual methods of that. I mean we should add asset_id field visible on manual account moves forms which allows to make other operations manually and assign them to assets. Is that good idea?

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#16

Hello, I have decided to publish the account_asset module at current stage.

Now it is in branch:
lp:~grzechu.g/openobject-addons/extra-5.0_account_asset

Current functionality:
    * Depreciation methods:
        - Straight-Line
        - Declining-Balance
        - Sum of Year Digits
        - Units of Production - this method can be used for individual depreciation schedule.
        - Progressive
    * Default accounts and other parameters for method types and categories
    * Method Parameters:
 - Starting interval (period)
 - Number of depreciation intervals
 - Number of intervals per year
 - Progressive factor for Declining-Balance method
 - Salvage Value
 - Life Quantity for Unit of Production method
        - Number of intervals calculated before current system (for continuing depreciation from other system)
    * Functionality:
 - Defining the asset in invoice when purchasing
 - Adjusting the asset value in purchasing Refund
 - Periodical entering of units of production
 - Periodical asset depreciation calculation
 - Sales invoice stops the depreciation and make final postings
        - Tracking changes in Asset History
    * Wizards:
 - Initial Values for continuing depreciation from previous system or other purpose
 - Revaluation
 - Abandonment
 - Method parameters changing
 - Suppressing and Resuming depreciation
 - Localisation changing
     * Postings direct and indirect
You can find quite big users guide in module description.

Known wishes not implemented:
- Calculating depreciation from given date (currently depreciation are calculated for whole periods/intervals only)
- Depreciation rounding
- Automatic tax depreciation starting (you can start tax depreciation manually with or without Initial Values wizard).
Above wishes are not used in my country and I don't think I can understand the needs correctly. I think these features should be developed by someone feeling better that nuances.
- Import wizard
This feature is needed as many system introductions will have to continue previous depreciations. But I am blind yet in importing. So you are invited to continue development.
- Multicompany
I can implement it for 6.0

Everyone is welcome to test and evaluate the module. According to your response I will fix bugs or make very small and safe improvements. If there is no critical response I will merge module back to extra-addons 5.0 in a week. I didn't keep any backward compatibility but I don't think it is problem as original module was unusable in any production introduction.

All the best
Grzegorz Grzelak

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#17

Good job Grzegorz; I'll try to give it a look tomorrow :)

Revision history for this message
Nhomar - Vauxoo (nhomar) said :
#18

Hello.

Our Team in Venezuela will try it too!

the day after tomorrow!

Thanks

Revision history for this message
Smappidev (8-contact-smappidev-com) said :
#19

Hi Guys,
I tried installing this module and I got the Error:
Error occurred while validating the field(s) res_model,src_model: Invalid model name in the action definition.

Any clue on this ?

BR,
Thanks

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#20

@ Smapppidev
It looks like xml error but I didn't have such behaviour in 5.0.7 and don't have now on 5.0.10. I have checked that all files were correctly pushed to the branch. Can you provide more information? What version are you using? Is it anything more in error message?

Revision history for this message
Smappidev (8-contact-smappidev-com) said :
#21

I am using 5.0.7.
I had a look at the source code and it seems that some files were not downloaded correctly.
I installed the module and now it works fine.
Thank you so much.
I will test it and let you know my feedback.

Revision history for this message
Grzegorz Grzelak (OpenGLOBE.pl) (grzegorz-og.pl) said :
#22

Hello, all my improvements account_asset are merged back to stable_5.0-extra-addons. So I close this bug and relevant blueprint. Farther development is of course welcome and needed.

Known issue: Duplicating of asset works bad.

By the way: I think modules should have not just field of author but some list of authors to expand it during development.

Thank you

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) said :
#23

Thanks Grzegorz, great work :)

> Farther development is of course welcome and needed.

We still haven't had time to do it (sorry). But, adapting it to the Spanish accounting requirements, is on our medium-term "TO-DO list".

> Duplicating of asset works bad

That usually happens with complex objects that point (one2many) to other objects that don't have an existence dependency.
But it can be fixed by overriding the default copy method:

    def copy(self, cr, uid, id, default=None, context=None):
        old = self.browse(cr, uid, id)
        vals = { 'name': old.name, ... }
        new_id = self.create(cr, uid, vals, context=context)
        return new_id

> I think modules should have not just field of author but some
> list of authors to expand it during development.

+1
Being an open source project, we can expect the modules to receive contributions from several authors along the time.

Revision history for this message
Nestor Diaz (nestorr122) said :
#24

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.
                                       ^

Revision history for this message
Nestor Diaz (nestorr122) said :
#25

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.
                                       ^

Can you help with this problem?

Provide an answer of your own, or ask mfl for more information if necessary.

To post a message you must log in.