0
私はこの2つのクラスを持っています。odoo - 別のクラスのフィールドに基づくドメインフィルタ
このclass Relocation(models.Model):
_name = 'test.plan_relocation'
type = fields.Selection()
price_id = fields.Many2one('test.plan_price',domain="[('type','=',type)]")
relocation_line_ids = fields.One2many('test.plan_relocation_line','relocation_id')
この
class RelocationLine(models.Model):
_name = 'test.plan_relocation_line'
relocation_id = fields.Many2one('test.plan_relocation')
source_id = fields.Many2one('test.plan_spending_actual',required=True)
available_source = fields.Float(related='source_id.available',default=0,readonly=True)
事は、私が "price_id" フィールドに基づいて "SOURCE_ID" をフィルタリングするです。 どうすれば実現できますか?
2つのクラスは1つのxmlにあります。 XMLの一部はこのように見えます。
<field name="relocation_line_ids">
<tree editable="bottom">
<field name="source_id" string="Source" />
<field name="available_source" />
</tree>
</field>
ありがとうございました。 test.plan_relocation_lineのXMLで
どういうわけか、それは動作しませんし、フィルターをしないのに役立ちます願っています。 Btw、両方のクラスに1つのXMLしかありません。私は質問を更新しました。ありがとう。 – Aurel
これは '親'を使って動作します。ありがとう@ KbiR。 – Aurel