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

[Solved] Cannot add a field to existing model- what has gone wrong? - Odoo8

By
Siobhan
on 5/28/15, 4:54 AM 592 views

Hello

I have followed instruction from an odoo class video but I can't see to get the field to be added to existing model:

CLASS:

class test(models.Model):

_name = 'res.partner'

_inherit = 'res.partner'

columns = {

testfield = fields.Char('TEST', size=20)

}


VIEW:

<record id="base_view_partner_form" model="ir.ui.view">

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form" />

<field name="arch" type="xml">

<field name="title" position="after">

<field name="testfield" />

</field>

</field>

</record>


No errors but no field where I would like it to be either. In development mode base.view_partner_form is the correct external ID. Please can someone help

restarted odoo server after these changes, then updated (with "upgrade" button) corresponding module ?

Temur
on 5/28/15, 7:04 AM
4

Jusab Sida (jsi)

--Jusab Sida (jsi)--
Tiny ERP Pvt Ltd
http://www.odoo.com
874
| 2 1 5
Gandhinagar, India
--Jusab Sida (jsi)--


Jusab Sida (jsi)
On 5/28/15, 8:22 AM

Hi Siobhan,

Try this one,

__.py

class res_partner(models.Model):

    _inherit = 'res.partner'

    testfield = fields.Char(string='TEST', size=20)

__.xml

<record id="base_view_partner_form_inheri" model="ir.ui.view">

<field name="name">res.partner.inherited.form.view</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form" />

<field name="arch" type="xml">

<field name="title" position="after">

<field name="testfield" />

</field>

</field>

</record>


Hope this will help u little bit...

It is telling me that "testfield" doesn't exist. Copy and pasted the code above and now I get this error_: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 530, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1399, in _dispatch_nodb func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match() File "/usr/lib/python2.7/dist-packages/werkzeug/routing.py", line 1423, in match raise NotFound() NotFound: 404: Not Found

Siobhan
on 5/29/15, 1:52 AM

Finally it worked.... I don't know what exactly when wrong or how it worked but in the end I uninstalled the module. Deleted everything I had done so far and then readded the code. It seemed to like it better when I uninstalled the module before I changed the code.. Only problem with this is that all my data is lost. I am going to try this again with existing module to see if it works without uninstalling the module. Thank you all for your help

Siobhan
on 5/29/15, 2:04 AM

enjoy :)

Jusab Sida (jsi)
on 5/29/15, 2:20 AM

Tried with another module and it is working.... really not sure where it went wrong to begin with.

Siobhan
on 5/29/15, 2:21 AM
0

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 5/28/15, 6:09 AM

Try this,

class res_partner(models.Model): 

_inherit = 'res.partner'

 testfield = fields.Char(string='TEST', size=20)


<record id="base_view_partner_form_inheri" model="ir.ui.view">

        <field name="model">res.partner</field>

        <field name="inherit_id" ref="base.view_partner_form" />

        <field name="arch" type="xml">

            <field name="title" position="after">

                <field name="testfield" />

            </field>

        </field>

</record>

Unfortunately, that hasn't worked either.

Siobhan
on 5/28/15, 6:32 AM
-1

Solanki Shamji

--Solanki Shamji--
1293
| 5 2 6
Baroda, India
--Solanki Shamji--

Hello!

Solanki Shamji
On 5/28/15, 6:24 AM

Hello,

Please refer below link for field definition.

https://www.odoo.com/documentation/8.0/howtos/backend.html#model-fields

Thanks.

Shamji.

 


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: 5/28/15, 4:54 AM
Seen: 592 times
Last updated: 3/1/16, 6:39 AM