Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
21674 Переглядів

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.

Аватар
Відмінити

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

Автор

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

Автор

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]

Автор Найкраща відповідь

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!


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лист. 24
1675
5
лип. 24
92981
1
груд. 23
3072
1
трав. 22
3697
0
січ. 21
2228