如何从delegation.child访问delegation.parent?

时间:2015-09-07 05:16:14

标签: openerp odoo odoo-8 openerp-8

我从odoo文档中获取了这个示例代码:

class Child0(models.Model):
    _name = 'delegation.child0'

    field_0 = fields.Integer()

class Child1(models.Model):
    _name = 'delegation.child1'

    field_1 = fields.Integer()

class Delegating(models.Model):
    _name = 'delegation.parent'

    _inherits = {
        'delegation.child0': 'child0_id',
        'delegation.child1': 'child1_id',
    }

    child0_id = fields.Many2one('delegation.child0', required=True, ondelete='cascade')
    child1_id = fields.Many2one('delegation.child1', required=True, ondelete='cascade')
    example_field = fields.Char('Example Field')

我可以轻松地从孩子那里访问父母example_field吗?怎么样?

0 个答案:

没有答案