2014-09-29 3 views
1

저는 OpenErp7의 완전한 초보자입니다. 나는 이미 OpenERP 7 - 자재 명세서 (BoM)에 제품 원가를 표시합니다.

'price': fields.related('product_id','product_tmpl_id.standard_price',type='float', size=64, relation="product.product", string="Price", store=True), 
'standardprice': fields.related('product_id','standard_price',type='float', size=64, relation="product.product", string="Standard Price", store=True), 

을 시도했지만 그것이 작동하지 않는 재료의 빌에서 제품의 비용 (product.standard_price?)와 공식 제품 비용 * 항목 번호

을 보여 드리고자합니다. .. 나는 미리 에 다비드

덕분에 어떤 힌트 감사하게 될 거라고 먼저 새 필드를 mrp.bom을 상속 추가해야

답변

1

'price_unit': fields.float('Unit Price')

다음과 같이 onchange_product_id 기능을 재정의 :

def onchange_product_id(self, cr, uid, ids, product_id, name, context=None): 
    if product_id: 

     prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context) 

     return {'value': {'name': prod.name, 'product_uom': prod.uom_id.id, 'price_unit': prod.standard_price}} 

    return {} 
+0

감사합니다! 일하고있어! – davidetrapani