我想从所选字段中检索不同的值。让我解释一下: 我有一门课:
class SchoolWebServices(models.Model):
_name = 'ecole.webservices'
name = fields.Char(string='Nom')
code_produit = fields.Char(string='Produit')
code_CDG = fields.Char(string='Centre de Gestion')
code_Catalog = fields.Char(string='Catalogue Produits')
我还有另外一门课:
class ResPartner_school(models.Model):
_name = 'ecole.partner.school'
_order = 'id desc'
half_pension_name = fields.Many2one(comodel_name="ecole.webservices",
string="Lieu")
我在班上有一个函数:学校你知道吗
@api.multi
def create_compte_cantine(self):
print "Inscription réussie"
get_halfpension_name = self.half_pension_name.id
if get_halfpension_name:
code_Catalog = self.env['ecole.webservices'].code_Catalog
我在变量get_halfpension_name
中得到了half_pension_name
的id,但是我也希望恢复同一个记录的code_Catalog
。如何做?你知道吗
您只需要使用点符号来检索值:
尽量遵守Odoo guideline的“规则”。例如,一个many21关系字段应该以_id->;
half_pension_id = fields.Many2one(comodel_name="ecole.webservices", string="Lieu")
结尾相关问题 更多 >
编程相关推荐