Skip to Content
Menu
This question has been flagged
2 Replies
3576 Views

Good day everyone, 

In custom module I inherited sale.order to add a few columns, however it does not add the one2many column.  Any idea what could be wrong?

Table sale_status exists and has a field called xorder_id


xstatus_line = fields.One2many('sale.status', 'xorder_id')


on  module update no errors displays


thanks in advance.


Avatar
Discard
Best Answer

Hi,
Please check the below example

Create new model ‘sale.status’


Class SaleStatus(models.Model):
     _name = "sale.status"

    xorder_id = fields.Many2one('sale.order', ‘Order’)
Inherit sale order to add One2Many field

    Class SaleOrder(models.Model):
        _inherit = "sale.order"

        xstatus_line  = fields.One2Many('sale.status, ‘xorder_id’, ’Lines’)
Avatar
Discard
Author Best Answer

reply to myself, the column xstatus_line is not created on the table but its works.  I guess thats the way odoo function internally.


Avatar
Discard