我在做奥多8。我有一个包含一组组合框类型字段和一个选择字段的视图。我想对组合框字段进行测试,如果所有字段都选中了,那么选择字段的值应该会改变。以下是我目前所掌握的情况:
def get_etat_dossier(self,cr,uid,ids,args,fields,context=None):
res = {}
for rec in self.browse(cr,uid,ids):
if rec.casier_judiciare==True: # test field if = true
res[rec.id]= 02 # field etat_dos type selection = Dossier Complet
else:
res[rec.id] = 01
return res
_columns= {
'casier_judiciare' : fields.boolean('Casier Judiciaire'), # field to test
'reference_pro' : fields.boolean('Réferences Professionnelles'),
'certificat_qual' : fields.boolean('Certificat de qualification'),
'extrait_role' : fields.boolean('Extrait de Role'),
'statut_entre' : fields.selection([('eurl','EURL'),('sarl','SARL')],'Statut Entreprise'),
'etat_dos': fields.selection([('complet','Dossier Complet'),('manquant','Dossier Manquant')],'Etat De Dossier'), # field ho change after test
}
这是我的观点的代码
^{pr2}$
向
onchange
字段添加一个onchange
属性,然后将所有其他要检查的字段作为参数传递给如下方法在您的模型文件中定义这样的方法,并使用if语句检查它们是否都是真的(这意味着它们都被检查过),如果是这样,那么您可以返回一个字典,其中包含您想要的选择字段值,在这种情况下,
^{pr2}$etat_dos
将更改为Dossier Complet
请注意,},它应该可以正常工作
onchange
只在casier_judiciare
字段上触发,但是您也可以在其他字段上设置{相关问题 更多 >
编程相关推荐