Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3577 Prikazi

Hi everyone, so it's simple I get an error when adding a simple constraint (IdentationError: unexpected ident) that I added directly into postgres without problem


class fleet_site(osv.Model):

_name = 'fleet.site'

_description = 'Information du site'

_order= 'name asc'

_columns = {

'name': fields.char('Nom', help='Nom du site', required=True),

'vehicle_ids': fields.one2many('fleet.vehicle','site_id','Vehicules')

}

_sql_constraints = [('fleet_site_name_unique','unique(name)', 'Le nom du site existe')]

Avatar
Opusti
Best Answer

Hi,

It is indentation error, so check you indentation 'spaces' it should be like:


class fleet_site(osv.Model):

#4 spaces

_name = 'fleet.site'

_description = 'Information du site'

_order= 'name asc'

_columns = {

'name': fields.char('Nom', help='Nom du site', required=True),

'vehicle_ids': fields.one2many('fleet.vehicle','site_id','Vehicules')

}

#4 spaces

_sql_constraints = [('fleet_site_name_unique','unique(name)', 'Le nom du site existe')]

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
jan. 23
26670
4
jun. 21
39646
1
dec. 20
2801
1
apr. 18
7929
3
sep. 15
9769