
Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn
由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解
本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!
开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号
如果您登录系统碰到问题,请在微信公众号留言:
請教關於many2one欄位畫面資料顯示的問題
-
例如我自定義一個Table,其中有一個many2one的欄位要referance到product.product
然後在OperERP顯示該自定義Table的view時,
我希望該many2one的欄位顯示在畫面上的是product.product中我指定顯示的欄位(例如name_template)
(當然在該many2one的欄位存放的是對應product.product的id)
請教大大該如何設定 感恩
-
两个方法:
1. 再建一个fields.related字段,比如:
fields.related('product_id', 'name_template', type='char', string='Name')
2. 覆写product.product的name_get方法,并在view中指定context,比如在view中设置context={'name_template':1}
def name_get(self, cr, uid, ids, context=None):
if context.get('name_template'):
XXXX #取需要的值,并返回
else:
return super(....).name_get(....)
-
感恩digitalsatori大不吝指點 謝謝
[quote author=digitalsatori link=topic=2940.msg9936#msg9936 date=1337663863]
两个方法:
1. 再建一个fields.related字段,比如:
fields.related('product_id', 'name_template', type='char', string='Name')
2. 覆写product.product的name_get方法,并在view中指定context,比如在view中设置context={'name_template':1}
def name_get(self, cr, uid, ids, context=None):
if context.get('name_template'):
XXXX #取需要的值,并返回
else:
return super(....).name_get(....)
[/quote]