Error occurred while validating the field(s)

Asked by mm alam

Hi every one,

I dont know, but i have read my view and py files, some 20 times, but I am not able to figure out that one setting works for a form, but not for another.

python file:

class acedmicyear_category(osv.osv):
    _name = "acedmicyear.category"
    _description = "academicyear"
    _columns = {
        'name': fields.char('Academic Year', size=64, required=True),
    }
acedmicyear_category()

view file:

  <record model="ir.ui.view" id="view_academicyear_category_form">
            <field name="name">acedmicyear.category.form</field>
            <field name="model">acedmicyear.category</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Category of ideas">
                    <field name="name" select="1"/>
                </form>
            </field>
        </record>

    <record model="ir.actions.act_window" id="action_acedmicyear_category">
        <field name="name">Categories</field>
        <field name="res_model">acedmicyear.category</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem name="Categories" parent="menu_config" id="menu_acedmicyear_category" action="action_acedmicyear_category"/>

but, each time, i try to upgrade, it says:

Error occurred while validating the field(s).........................

I surfed in the source code and found that in the "orm.py", the method _validate is giving this error.

Please help me and give me the right hint, to solve this problem.

Last time, the error was solved, when I created a new database.

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
mm alam (masoom-alam) said :
#1

These lines of code at the server end, are giving me the error:

 def _validate(self, cr, uid, ids, context=None):
        context = context or {}
        lng = context.get('lang', False) or 'en_US'
        trans = self.pool.get('ir.translation')
        error_msgs = []
        for constraint in self._constraints:
            fun, msg, fields = constraint
            if not fun(self, cr, uid, ids):
                translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg
                error_msgs.append(
                        _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
                )
                self._invalids.update(fields)
        if error_msgs:
            cr.rollback()
            raise except_orm('ValidateError', '\n'.join(error_msgs))
        else:
            self._invalids.clear()

can any body, provide an exact error reason, Please

Thanks!

Revision history for this message
mm alam (masoom-alam) said :
#2

Now look at this line of code:

 <record model="ir.ui.view" id="view_semester">
            <field name="name">semester.main.form</field>
            <field name="model">semester.main</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Semester">
                  <field name="name" select="1"/>
    <field name="semesterdescription" select="1"/>
                </form>
            </field>
        </record>

    <record model="ir.actions.act_window" id="semesterprogram1">
        <field name="name">semester.mainaction</field>
        <field name="res_model">semester.main</field>
 <field name="view_id" ref="view_semester"/>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
       <menuitem name="Semester Program" parent="menu_config" id="menu_semesterprogram" action="semesterprogram1"/>

Does this means that, for every piece of code, we will have to drop the database and then make it again. Quite strange.

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#3

Hello Masoom Alam,

<menuitem name="Categories" parent="menu_config" id="menu_acedmicyear_category" action="action_acedmicyear_category"/>

I think the problem is here : 'menu_config' id is related with which module you need to put the related module name also for reference.

Hope this will help you.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask mm alam for more information if necessary.

To post a message you must log in.