【问题标题】:OpenERP 7 - Display Product Cost in Bill of Materials (BoM)OpenERP 7 - 在物料清单 (BoM) 中显示产品成本
【发布时间】:2014-09-29 15:17:45
【问题描述】:

我是 OpenErp7 的初学者。 我想在物料清单中显示产品成本 (product.standard_price?) 和公式产品成本 * 项目编号

我已经试过了

 '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),

但它不起作用......我会很感激任何提示

提前致谢 大卫

【问题讨论】:

    标签: openerp openerp-7


    【解决方案1】:

    你应该先继承mrp.bom并添加一个新字段'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 {}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-26
      • 2018-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多