1
on_changeを使用して選択フィールドの値を変更しようとしています。私は以下のコードを持っています。on_changeを使用して選択フィールドの値を変更します。
の.xml
<field name="product_id" on_change="onchange_partner_id_override(product_id, context)"
の.py
class sale_order_line(osv.osv):
_inherit = "sale.order.line"
_columns = {
'product_id': fields.many2one('product.product', "Product"),
'price_select': fields.selection(SELECT_PRICE, "Unit Price"),
}
def product_id_change_override(self, cr, uid, ids, product, context=None):
result = []
product_obj = self.pool.get('product.product')
product_obj = product_obj.browse(cr, uid, product, context=context_partner)
global SELECT_PRICE
SELECT_PRICE = [
('sale_price', product_obj.list_price),
('dist_price', product_obj.distributor_price),
('emp_price', product_obj.employee_price),
]
# How could I change the value of my selection field 'price_select'
return {'value': result}
しかし、私は私の選択フィールドにこのデータを追加する方法についての構文を知りません。 誰かが私を助けてくれますか!
。 product_id_changeは私にエラーを与えます。 AttributeError: 'super'オブジェクトに 'product_id_change'属性がありません – weelDaw
@weelDawエラーログを貼り付けてください。 – Zety
この質問は既に解決されています。しかし、解決策が私の質問からあまりにも遠いので、投稿できません。 :) .. – weelDaw