Search code examples
viewmodelodoofield

odoo wizard cant inherit the model


I created a model like this

class FoundCheque(models.TransientModel):
    _name = "found.cheque"


    date_Found = fields.Date(string='Found Date', default=fields.Date.context_today, required=True, translate=True)

and its view

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <data>
        <record model="ir.ui.view" id="wizard_found_cheque">
            <field name="name">found.cheque.wizard</field>
            <field name="model">found.cheque</field>
            <field name="arch" type="xml">
                <form string="found Cheque">
                    <group>
                        <field name="date_found" style="width:40%%"/>
                    </group>
                    <footer>
                        <button name="found_cheque" string="Post" type="object" class="oe_highlight"/>
                        or <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>
    </data>
</odoo>

but when I try to update the module after restarting the service it just says:

Field `date_found` does not exist

Error context:
View `found.cheque.wizard`
[view_id: 4100, xml_id: n/a, model: found.cheque, parent_id: n/a]
None" while parsing /opt/odoo/odoo11-custom-addons/cheque_management/views/found_cheque.xml:4, near
<record model="ir.ui.view" id="wizard_found_cheque">
            <field name="name">found.cheque.wizard</field>
            <field name="model">found.cheque</field>
            <field name="arch" type="xml">
                <form string="found Cheque">
                    <group>
                        <field name="date_found" style="width:40%%"/>
                    </group>
                    <footer>
                        <button name="found_cheque" string="Post" type="object" class="oe_highlight" confirm="آیا مطمئن هستید؟"/>
                        or <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>

and just to add I restarted the service several times

more information will be added on request


Solution

  • Your field name in python file is date_Found and date_found in xml. Both are different. so change field name in xml file