コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3582 ビュー

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')]

アバター
破棄
最善の回答

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')]

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 23
26672
4
6月 21
39653
1
12月 20
2802
1
4月 18
7930
3
9月 15
9769