Skip to Content
Menu
This question has been flagged
1 Odpoveď
21673 Zobrazenia

I'm developing a custom module, I just started and coding the view I have a context error with my variables, how can I solve this, my view is inherited from product form view

<record id="view_product_form_inherit_property_view_form" model="ir.ui.view">
    <field name="name">property_management_system.property.view.form</field>
    <field name="model">property_management_system.property</field>
    <field name="mode">primary</field>
    <field name="inherit_id" ref="product.product_normal_form_view"/>
    <field name="arch" type="xml">
      <xpath expr="//div[@name='options']" position="inside">
        <div>
          <field name="property_ok"/>
          <label for="property_ok"/>
        </div>
      </xpath>
    </field>
  </record>


My model is inherits from product.product


class Property(models.Model):
    _name = "property_management_system.property"
    _inherit = ["product.product"]
    property_ok = fields.Boolean("Is Property")


I've been searched a lot and not getting answer, so I decide post this, I can't find wheres the problem.

Avatar
Zrušiť

Please post your error here, then we can easily find out the issue.

Autor

ok let me use the English lang to get it in the language.

Autor

I Can't edit my post, don't know why, so, here is the error:

File "/opt/odoo/devodoo/odoo/addons/base/ir/ir_ui_view.py", line 464, in raise_view_error

raise ValueError(message)

ValueError: Field `property_ok` does not exist

Error context:

View `property_management_system.property.view.form`

[view_id: 1363, xml_id: property_management_system.view_product_form_inherit_property_view_form, model: property_management_system.property, parent_id: 1009]

Autor Best Answer

Ok, I find the issue, in the action view I was calling the view with the wrong model.


I change

<field name="res_model">product.product</field>

to

<field name="res_model">property_management_system.property</field>


And it work!


Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
nov 24
1675
5
júl 24
92981
1
dec 23
3072
1
máj 22
3697
0
jan 21
2228