Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
5762 Zobrazení

showing below error
odoo.tools.convert.ParseError: "Error while validating constraint

Field `assignment_marks` does not exist

Error context:
View `op.marksheet.line.inherit`
[view_id: 1776, xml_id: o3_annual_student_report.op_marksheet_line_inherit, model: op.marksheet.line, parent_id: 1002]
None" while parsing file:/c:/program files (x86)/odoo 12.0/server/odoo/addons/o3_annual_student_report/assignment_marks.xml:5, near
<record model="ir.ui.view" id="op_marksheet_line_inherit">
      <field name="name">op.marksheet.line.inherit</field>
      <field name="model">op.marksheet.line</field>
      <field name="inherit_id" ref="openeducat_exam.view_op_marksheet_line_form"/>
      <field name="arch" type="xml">

          <field name="total_marks" position="after">
                 <field name="assignment_marks"/>
          </field>
      </field>
    </record>
my python code:



class assignments(models.Model):
_inherit = 'op.marksheet.line'

assignment_marks = fields.Float("Assignment Marks", compute='_compute_assignment_marks', store=True, default=0)
please help me to solve this
Avatar
Zrušit

These tips help you to get the basic idea about customization in odoo

https://github.com/sehrishnaz/learnopenerp/wiki

Nejlepší odpověď

Solution1:

First make sure that you added the py file to __init__.py .

Second: Your inherited view shows its inherited from openeducat_exam, make sure that it's add to depends modules in __manifest__.py file.

Then:

- Restart the service.

- Upgrade your module.

Solution 2:

Comment the below line in view:

<field name="assignment_marks"/>

and then restart the service and upgrade your module and check if the field created in the DB from settings -> Technical -> Models ->   then search for op.marksheet.line and check if the field created.

Then you can uncomment the above line and restart the service and upgrade the module.


Avatar
Zrušit
Nejlepší odpověď

Hi,

Make sure that the module is upgraded after adding the new field.

See: How to Fix Field Does Not Exist Error Odoo

Thanks

Avatar
Zrušit