I am trying to do something really simple here. But I can't find anything in the docs, or on help.openerp.com
I added a field (which is a many2one relationship with another table) on a form. This created a dropdown menu where can either pick or create new values.
If you click on "Create and Edit", this will open a new window, where you have a field that you can fill in, and save. But the label for this field is "unknown". Someone explained to me that I need to create a view for this form.
So I did, I created this view, at first, I inherited from another form (the users' one), but it throwing me error, moaning about missing fields. My question is: What should I inherit from?
The process works without defining my own view for this, but whenever I pick an existing record, create a new one, the value doesn't appear, but instead I have the name of the table, and its identifier as a link to the record (that will open a new window if I recall correctly). Is there a way to do a lookup instead, and display the value?
Here the code:
counties_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="hubclub_counties_form">
<field name="name">hubclub.counties.form</field>
<field name="model">hubclub.counties</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<group>
<field name="county" />
</group>
</field>
</record>
</data>
</openerp>
extra-attributes.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="hubclub_res_users_form">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[2]" position="after">
<page string="Hubclub specific settings">
<group>
<field name="county_id" />
</group>
</page>
</xpath>
</field>
</record>
</data>
</openerp>
__openerp__.py
# -*- coding: utf-8 -*-
{
'name': 'Hubclub module',
'version': '1.0',
'author': 'Openapp',
'category': 'Tools',
'depends': ['base', 'point_of_sale'],
'data': ['extra-attributes.xml', 'counties_view.xml'],
'demo': [],
'installable': True,
}
hubclub_module.py
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class hubclub_counties(osv.osv):
_name = 'hubclub.counties'
_columns = {
'county': fields.text(),
}
_sql_constraints = [('county_uniq', 'unique(county)',
'Country already exists')]
# User
class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
_columns = {
'county_id': fields.many2one('hubclub.counties', 'County'),
}
_defaults = {
}
res_users()
hubclub_counties()
what is the error? also check that you have defined the model res_users inside hubclub_counties.
There is no error, just the behavior I described. Where can I find documentation on how to define res_users in hubclun_counties?