Skip to Content
Menu
This question has been flagged

Hi hello, please somebody can help with this code, look ok for me but I got this error all the time, please i need help to understand 


class sale_order(models.Model):
_inherit = 'sale.order'

warehouse_log = fields.One2many('warehouse.log', 'sale_order', 'Warehouse Log')
class WarehouseLog(models.Model):
_name = 'warehouse.log'
_description = 'Warehouse log'

name = fields.Char('Name')
sale_order = fields.Many2one('sale.order', 'Sale Order')



<odoo>
<data>


<record id="sale_order_form_page_warehouse_log" model="ir.ui.view">
<field name="name">sale_order_form_page_warehouse_log</field>
<field name="model">sale.order</field><!-- Model -->
<field name="inherit_id" ref="sale.view_order_form"/><!-- External ID -->
<field name="arch" type="xml">
<notebook position="inside">
<page string="Warehouse Log">
<field name="warehouse_log">
<tree editable='bottom'>
<field name="id"/>
<field name="name"/>
</tree>
</field>

</page>
</notebook>
</field>
</record>

</data>
</odoo>

File "/opt/odoo/odoo/models.py", line 1130, in _validate_fields

    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))

odoo.tools.convert.ParseError: "Error while validating constraint


Field `warehouse_log` does not exist


Error context:

View `sale_order_form_page_warehouse_log`

[view_id: 1585, xml_id: general_options.sale_order_form_page_warehouse_log, model: sale.order, parent_id: 1034]

None" while parsing /opt/odoo/extra_addons/ours/general_options/views/sale_order.xml:5, near



Avatar
Discard
Best Answer

Hi, 

Please check your inherited py file have you added in __init__.py file

then general_options module execute first.

Thanks



Avatar
Discard
Author

Thank so mush, in my example on top the 2 class are in my warehouse_system module and the view in in another module, what i did was i move the view into the warehouse module and now works, thank for your tip

Related Posts Replies Views Activity
0
Sep 16
2349
0
May 24
46
5
Aug 24
42983
2
Apr 24
949
3
Jun 23
3146