I'm experimenting with sequences and handle widge, I'm using two test models to make it work
Country
# -*- coding:utf-8 -*-
from openerp import models,fields,api
class t_country(models.Model):
_name = "t_country"
_rec_name = "description"
_order = "description"
description = fields.Char(string="description",required=True)
states = fields.One2many('t_states','country_id',string="states")
States
# -*- coding:utf-8 -*-
from openerp import models,fields,api
class t_states(models.Model):
_name = "t_states"
_rec_name = "description"
_order = "sequence"
description = fields.Char(string="description",required=True)
country_id = fields.Many2one('t_country',readonly=True, string="country")
sequence = fields.Integer(readonly=True,string="sequenece")
And I've been added the following line to my view
<field name="sequence" widget="handle" string="sequence"/>
But when I move the different records on the model their sequence numbers are not ordered as they have to.
The widget needs to be used with a function to change the sequence id's correctly?
EDIT
Added a image of a test screen
I tried removing the readonly arg from my sequence butstill have the same result. The only way to get the correct sequence with my code its moving a item to the first position to the list, then the rest of the sequence get calculated in order