Skip to Content
Menú
This question has been flagged
2 Respostes
915 Vistes

When creating a new module on Odoo, everything goes well - I install and execute it, and it works. However, as soon as I try to add new XML fields or functions, it validates the new fields in XML but shows an error in Python, saying that the attribute declared in Python does not exist.

Note: There were no errors before I added the "result2" attribute.


Avatar
Descartar

please attach a screenshot of your python code block

Autor

from odoo import fields, models

class grille(models.Model):
_name = "evaluation.grille"
_description = "evaluation grille"

prise_con = fields.Integer(string="PRISE DE CONTACT ACCEUIL CLIENT :", required=True)
proc = fields.Integer(string="ELIGIBILOTE PROSPECT", required=True)
pres1 = fields.Integer(string="Présenation/Accroche/Question/Filtre/Reformulation", required=True)
pres2 = fields.Integer(string="Présentation des produits /bénifices clients/Presentation tarif", required=True)
result = fields.Float('Result', compute='_compute_sum', store=True)

Autor Best Answer

"Even if I put the same attribute, it's not recognized by Python for printing. Any modification in Python is not being considered; however, in XML, it is executable."

Avatar
Descartar
Best Answer

Hi,

The error you're experiencing is likely because you added a new field in the XML view but didn't add the corresponding field in the Python model. Odoo requires that the fields declared in the XML view must also exist in the Python code.

Based on the code you provided, it seems like you mentioned a field called "result2" that is not present in the Python code.

To fix the error, you need to add the "result2" field (or whichever field you intended to add) to the Python model "grille" as well.

Hope this will help you

Thanks


Avatar
Descartar