Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Problem with very simple module on account.invoice extension

By
Angela
on 2/13/13, 1:25 PM 3,459 views

Hi, this is a simple issue on a simple example (with all data provided here). I'm using OpenERP 7.0-20130212-002145

I've created a very simple module as shown below (it adds one field named dtc_dc_ident to account.invoice object and view), and when I install it all goes fine, but when I update it (with no change at all) I get the following error (in the server log file):

2013-02-13 18:17:22,721 1448 ERROR test7 openerp.osv.orm: Can't find field 'dtc_dc_ident' in the following view parts composing the view of object model 'account.invoice':

  • a_test_inherit.account.invoice.form

If I comment the line <field name="dtc_dc_ident" required="1"/> it works fine (and the field dtc_dc_ident is visible in the account.invoice object model)

This problem only arises on account.invoice, for example on hr.holidays all is OK.

Here is the module structure (4 files):

a_test

__init__.py __openerp__.py a_test_account_invoice.py a_test_account_invoice.xml

Here is the content of each file :

__init__.py

import a_test_account_invoice

__openerp__.py

{
"name" : "short description : a_test",
"version" : "1.0",
"author" : "Test DTC",
"website" : "none",
"category" : "Generic Modules/Others",
"depends" : ["base", "account" ],
"description" : "Description : A Test  module",
"init_xml" : ["a_test_account_invoice.xml", ],
"demo_xml" : [],
"update_xml" : [],
"active": False,
"installable": True,
"application": True,
}

a_test_account_invoice.py

from osv import fields, osv
import os
import time
import pooler
import codecs
import datetime
import string

from tools.translate import _
class account_invoice(osv.osv):
  _name = 'account.invoice'
  _inherit = 'account.invoice'
  _description = 'Invoice'
  _columns = {
    'dtc_dc_ident': fields.char('Identifiant DC', required=False, size=32),
  }
account_invoice()

a_test_account_invoice.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="a_test_inherit_invoice_form" model="ir.ui.view">
<field name="name">a_test_inherit.account.invoice.form</field>
<field  name="inherit_id"  ref="account.invoice_form"/>
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="dtc_dc_ident" required="1"/>
</field>
</field>
</record>

</data>
</openerp>

Not sure I'm allowed to push my post back up in this way... but I would like it if someone could test this and confirm what I get...

Thanks

Angela
on 2/14/13, 11:37 AM

No, this is not a good practice. Although I converted your "answer" into a comment.

Antonin Bourguignon (abo)
on 2/14/13, 11:40 AM
0
Juanjo Algaz
On 2/14/13, 1:11 PM

Maybe you can change:

"init_xml" : ["a_test_account_invoice.xml", ],

by:

"update_xml" : ["a_test_account_invoice.xml", ],

0
Angela
On 2/14/13, 3:08 PM

Try to :

uninstall your module
restart your server OpenERP
install your module

I had the same problem and it's the only one solution i found. Tell me if it work.

Yes, this will work, but this doesn't solve my issue, because normally you can update a module without uninstalling it (and restarting the server is only in case you change the python code). Besides, the above example works perfectly if you simply replace account.invoice with hr.holidays (and adapt a little)... so I'm sure it's related to something specific with account.invoice.

ybe you can change:

"init_xml" : ["a_test_account_invoice.xml", ],

by:

"update_xml" : ["a_test_account_invoice.xml", ],

I'd tested this already... but I'll test again just to see.

Thanks for your input in all cases, I'll be back after a few more tests.

Well, I've done the above tests and it performs as I expected.... indeed, uninstall and reinstall works fine, but this isn't right, upgrade should work too.

Changing using update instead of init didn't change anything....

Angela
on 2/14/13, 4:50 PM

Again... if I use hr.holidays instead of account.invoice no problem arises..

Angela
on 2/14/13, 4:52 PM
0

Bonnet Denis

--Bonnet Denis--
925
| 5 6 8
Vannes, France
--Bonnet Denis--

Engeneer at MGS Consulting Ouest at Vannes, FRANCE

Bonnet Denis
On 2/14/13, 12:13 PM

Try to :

  1. uninstall your module
  2. restart your server OpenERP
  3. install your module

I had the same problem and it's the only one solution i found. Tell me if it work.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/13/13, 1:25 PM
Seen: 3459 times
Last updated: 3/16/15, 8:10 AM