I created a custom module for odoo 8.0 following the instructions found here:
https://www.odoo.com/documentation/8.0/reference/orm.html#inheritance-and-extension
and here:
http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7/
There is no problem adding new fields when I first install it but I have problems adding more fields - by updating the custom module.
I check through
Settings --> Database Structure -->Fields
and I can find the custom fields added when I first installed the custom modules but none of the fields added later.
Of course, after editing my module's .py file I always restart the odoo server.
When I reference the new fields in my custom view and try to 'upgrade' through the admin interface, I get an error that
Field 'a_new_field_here' does not exist
What can I do to create the new fields (columns) when I restart the odoo server ?
Here is (a simplified version of) the source code of the custom module per file
__init__.py
import custom_tasks
__openerp__.py
{
'name': "custom_tasks",
'version': "0.0.3",
'author': "George",
'category': "Tools",
'depends': ['project'],
'data': ['task.xml'],
'demo': [],
'installable': True,
'auto_install': False,
'application': False,
'description': "Custom tasks module",
}
custom_tasks.py
# vim; set filencoding= utf-8
from openerp import api
from openerp.osv import fields, osv
class custom_tasks(osv.osv):
_name = "project.task"
_inherit = "project.task"
_columns = {
'name': fields.char('Task Summary', track_visibility='onchange', size=128, required=True, select=True),
'c_task_attachement': fields.binary('Attachemnt (pdf)'),
'c_task_numbera': fields.integer('Παράμετρος Α'),
'c_task_numberb': fields.integer('Παράμετρος Β'),
'c_task_numberc': fields.integer('Παράμετρος Γ'),
'date_deadline': fields.datetime('Deadline', select=True, copy=False),
}
@api.onchange('project_id') # if these fields are changed, call method
def _check_change(self):
self.name = self.project_id.name
custom_tasks()
task.xml
<openerp>
<data>
<record model="ir.ui.view" id="custom_task">
<field name="name">project.task.form</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<xpath expr="/form/sheet/group/group[1]/field[@name='project_id']" position="replace"> </xpath>
<xpath expr="/form/sheet/h1" position="inside">
<field name="project_id" class="oe_inline" required="1" />
</xpath>
<xpath expr="/form/sheet/h1/field[@name='name']" position="replace">
<field name="name" required="1" invisible="1"/>
</xpath>
<xpath expr="/form/sheet/group/group[2]/field[@name='date_deadline']" position="replace">
<field name="date_deadline" required="1"/>
</xpath>
<xpath expr="/form/sheet/group/group[2]/field[@name='categ_ids']" position="replace">
<field name="c_task_attachement" widget="binary"/>
</xpath>
<xpath expr="/form/sheet/group" position="after">
<group>
<field name="c_task_numbera" />
<field name="c_task_numberb" />
<field name="c_task_numberc" />
</group>
</xpath>
</field>
</record>
</data>
</openerp>
did you add your py file in the __init__.py of your custom module?
Can you show your code George Rodopoulos
post your code here.
I have the same problem. Did you find any solution instead of uninstalling and installing the module each time a new field is created?