此问题已终结

I am trying to generate a unique id using ir.sequence for my newely created model. Here is my python code

name = fields.Char(string="Name",required=True, default= lambda self: self.env['ir.sequence'].next_by_code('pv.plant.sequence'))

the xml is

record id="sequence_pv_plant" model="ir.sequence">

    field name="name">PV Plant Sequence

    field name="code">pv.plant.sequence

    field name="prefix">PV

    field name="padding">4

/record>

this works completely fine! 

but when i try to make the name field as"readonly" the number being generated is with a step of +2. I have checked my step value in the technical--> sequences and it is 1. 


This occurs only when the readonly = True. 
Any help would be appreciated.   

形象
丢弃