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

Onchange method internal server error.

By
Suthan
on 4/28/14, 8:23 AM 1,226 views

Hi,

I'm having some trouble when retrieving two fields using onchange method from another class. 'activity_name', and 'region_id'

The error i'm getting is this.

XmlHttpRequestError INTERNAL SERVER ERROR

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <title>500 Internal Server Error</title>
 <h1>Internal Server Error</h1>
 <p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is  an error in the application.</p>

Does anyone know what is causing this? Below is my Code

class activity_summary(osv.osv):
_name = "budget.activity_summary"
_rec_name = "activity_summarycode"
_columns = {
'activity_summarycode' : fields.many2one("budget.activity_year", "Activity Summary Code", ondelete= "no action", required=True ),
   'activity_name' : fields.related("activity_summarycode", "activity_name", type="char", string="Activity Name"),
'region_id' : fields.related("activity_summarycode", "mgmt_code", type = "char", string="Management Unit Code", size=64, store = True),
}
_sql_constraints = [
    ('activity_summarycode_unique', 'UNIQUE(activity_summarycode)', 'Each Activity year code is unique.'),
]



Activity year class:

class activity_year(osv.osv):
_name = "budget.activity_year"
_rec_name = "activity_yearcode"
_columns = {
    'activity_yearcode' : fields.char("Activity Code", size=64, required=True),
    'activity_name' : fields.char("Activity Name", size=128),
    'mgmt_code' : fields.many2one("budget.org_table","Management Unit Code"),
    }
_sql_constraints = [
    ('activity_yearcode_unique', 'UNIQUE(activity_yearcode)', 'Each activity code is unique.'),
]


class org_table(osv.osv):

_name = "budget.org_table"
_rec_name = "org_code"
_columns = {
    'org_code' : fields.char("Code", size=64),
    'org_name' : fields.char("Name"),
}
_sql_constraints = [
    ('org_code_unique', 'UNIQUE(org_code)', 'Each org_table ID is unique.'),
]

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

0 follower(s)

Stats

Asked: 4/28/14, 8:23 AM
Seen: 1226 times
Last updated: 3/16/15, 8:10 AM