Help

2

How can I recover from 500 Internal Server Error after model changes

Avatar
Trevor Nemanic

My Odoo version 9 instance now returns a "500 Internal Server Error" after I changed the name of a model and an attribute inside. They both have since been renamed and old tables dropped from the database. I've also cleared all tuples in the current table, and restarted the server, but no success. My code follows the guide on "Building a Website" from Odoo.  The code I originally changed was class Teachers to Customers and attribute fix_tribe.teachers to fix_tribe.customers. My current code is below:

from models.py

class Teachers(models.Model):
_name = 'fix_tribe.teachers'
name = fields.Char()
biography = fields.Html()
course_ids = fields.One2many('fix_tribe.courses', 'teacher_id', string="Courses")

from views.xml

  <record id="action_fix_tribe_customers" model="ir.actions.act_window">
<field name="name">Customers</field>
<field name="res_model">fix_tribe.teachers</field>
</record>

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

<field name="name">FixTribe teachers: form</field>

<field name="model">fix_tribe.teachers</field>

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

<form>

<sheet>

<label for="name"/> <field name="name"/>

<label for="biography"/>

<field name="biography"/>

<field name="course_ids">

<tree string="Courses" editable="bottom">

<field name="name"/>

</tree>

</field>

</sheet>

</form>

</field>

</record>

Avatar
Discard
3 Answers
0
Avatar
Trevor Nemanic
Best Answer

I went into the log file /server/openerp-server.log and it showed that my __openerp__.py file was attempting to reference a data file that does not exist. Removing this reference solved the error. 

Happy Odoo's answer did in fact cause the server to start, but not solve the problem.

Dr Obx's answer only would work for Linux and I am running Windows

Avatar
Discard
4
Avatar
HappyOdoo
Best Answer

Trevor Nemanic

If your code is in New Module then Remove that Module folder form addons directory and restart the ERP.

it will work. 500 Internal Error will Remove.

if ERP started then you have to check this custom code.


Avatar
Discard
1
Avatar
Dr Obx
Best Answer

I strongly recommend to run Odoo server from the console if You testing a new code. If there is any problem it will tell you what cause it.
To do it:

1. Open Terminal
2. type 'service odoo stop'
3. as a root type: sudo su - odoo -s /bin/bash
4. run 'openerp-server'
then watch the console against the errors.

You can see there all messages generated by openerp-server also if there is any problem you can copy and paste it in your posts, it can be very helpful  :)

 

Avatar
Discard