Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
21672 Näkymät

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
Hylkää

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

Tekijä

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

Tekijä

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]

Tekijä Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
marrask. 24
1673
5
heinäk. 24
92977
1
jouluk. 23
3072
1
toukok. 22
3695
0
tammik. 21
2227