Search code examples
odooodoo-8

Why Odoo not insert this two columns?


I'm creating a custom module to extend fields in sale.order.line but Odoo (v8) doesn't create these two columns.

class sale_order_line_ext(osv.Model):
    _name = 'sale.order.line'
    _inherit = 'sale.order.line'

    _columns = {
        'supplier_name': fields.char('Supplier name'),
        'supplier_ref': fields.char('Product reference'),
    }

sale_order_line_ext()

I have already created some columns in sale.order previously, but I don't see anything wrong here. What is my error?


Solution

  • In your comment, error log says supplier_name doesn't exist in table sale.order.line' , to check this go to settings -> Technical -> Database Structure -> Models and find sale.order.line then you will see all fields. If not try below code:

    class sale_order_line_ext(osv.Model):
        _inherit = 'sale.order.line'
    
        _columns = {
        'supplier_name': fields.char('Supplier name'),
        'supplier_ref': fields.char('Product reference'),
         }
    
    sale_order_line_ext()