Question

Here is what I did in python:

class pos_order_line(osv.osv):
    _inherit = "pos.order.line"
    _columns = {
        'order_line_state_id': fields.many2one('pos.order.line.state', "Order Line State"),
    }

class pos_order_line_state(osv.osv):
    _name = "pos.order.line.state"

    _columns = {
        'name': fields.char('Name', size=18),
        'sequence': fields.integer('Sequence'),
    }

And in javascript I do:

var order = this.pos.get('selectedOrder');    
var line = order.getSelectedLine();

But line doesn't have order_line_state_id even though the column is in the database (checked with PGadminIII)

What am I doing wrong??

Was it helpful?

Solution

this.pos is a reference to the original unmodified PosModel, not the one you have inherited. That's why you have the order_line_state_id in the database but it's not a member variable of the JS object.

I don't yet have any experience on JavaScript hacking in OpenERP so I don't know how to solve this. You might want to browse the JS code of the point_of_sale module and make the PosModel use your custom module instead of the original one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top