ビュー内の別のフィールドのドメインを変更するOdoo UIを使用してサーバーアクションを作成しようとしています。これらのドキュメントでOdooサーバーアクションからドメインを返す方法
https://www.odoo.com/documentation/10.0/reference/orm.html#odoo.api.onchange
を、彼らは場合、私はのソースコードにあったことを示している:これは、あなたが以下の文書に見ることができるようOdooのソースコードを扱うときにはかなり一般的なユースケースのようですモデル、私はonchange
メソッドを定義することができ、例えば、ドメインを返し、私はsale.order.line
モデルで達成しようとしている行動は、次のようになります。つまり
@api.onchange('product_id')
def _onchange_product(self):
return {
'domain': {'route_id': [('id', 'in', x_all_route_ids.ids)]}
}
、受注の製品route_idフィールドで利用可能なオプションを更新します。
UIで作成されたサーバーアクションを介して同じことを達成する方法はありますか?私は、Pythonコードからドメインを返す方法を理解するのに困っています。コードセクションで
ノートは言う:
# Available variables:
# - time, datetime, dateutil, timezone: Python libraries
# - env: Odoo Environement
# - model: Model of the record on which the action is triggered
# - record: Record on which the action is triggered if there is one, otherwise None
# - records: Records on which the action is triggered if there is one, otherwise None
# - log : log(message), function to log debug information in logging table
# - Warning: Warning Exception to use with raise
# To return an action, assign: action = {...}
私がドメインを返すためにこれを使用することができますどのように表示されません。誰も考えていますか?私は単にPythonコードフィールドを設定しようとした
:
domain = {'route_id': [('id', 'in', record.x_all_route_ids)]}
しかし、それは動作しません。 route_idリストは変更されていません。
非常に興味深い! – CZoellner