SOLUCION
def create(self,cr,uid,vals,context=None): new_name = False if vals.get('patient_id',False) and vals['patient_id'].strip() == '': new_name = True elif not vals.get('patient_id',False): new_name = True if new_name: vals.update({'patient_id':self.pool.get('ir.sequence').get(cr, uid, 'medical.patient')}) return super(patient_data, self).create(cr, uid, vals, context)
CON ESTO SE OBTENDRA LA SECUENCIA SOLO SI EL REGISTRO SE CREA DE LO CONTRARIO NO SE INCREMENTARA LA SECUENCIA
SOLUCION
def create( self,cr, uid,vals, context= None): 'patient_ id',False) and vals['patient_ id'].strip( ) == '': 'patient_ id',False) : update( {'patient_ id':self. pool.get( 'ir.sequence' ).get(cr, uid, 'medical. patient' )})
new_name = False
if vals.get(
new_name = True
elif not vals.get(
new_name = True
if new_name:
vals.
return super(patient_data, self).create(cr, uid, vals, context)
CON ESTO SE OBTENDRA LA SECUENCIA SOLO SI EL REGISTRO SE CREA DE LO CONTRARIO NO SE INCREMENTARA LA SECUENCIA