将供应商代码添加到采购订单行
Add supplier code to purchase order line
我如何在 odoo 中将字段 suppliercode 添加到我的 purchase.order.line 模型
界面
在报告中我可以用
<span t-field="line.product_id.seller_ids and line.product_id.seller_ids[0].product_code"/>
(不是我的解决方案,是在 Whosebug 上找到的)
我是像图片中那样使用它还是在服务器操作中使用它
您应该在采购订单行中创建简单的计算字段。
@api.multi
def get_supplier_code(self):
product_supplier_info_obj=self.env['product.supplierinfo']
for line in self:
purchase_order=line.order_id
supplier_info=product_supplier_info_obj.search([('product_tmpl_id','=',line.product_id.product_tmpl_id.id),('name','=',purchase_order.partner_id.id)],limit=1)
line.product_code=supplier_info.product_code
product_code=fields.Char(compute="get_supplier_code",store=False,string="purchase Code")
这可能对你有帮助。
我如何在 odoo 中将字段 suppliercode 添加到我的 purchase.order.line 模型 界面
在报告中我可以用
<span t-field="line.product_id.seller_ids and line.product_id.seller_ids[0].product_code"/>
(不是我的解决方案,是在 Whosebug 上找到的)
我是像图片中那样使用它还是在服务器操作中使用它
您应该在采购订单行中创建简单的计算字段。
@api.multi
def get_supplier_code(self):
product_supplier_info_obj=self.env['product.supplierinfo']
for line in self:
purchase_order=line.order_id
supplier_info=product_supplier_info_obj.search([('product_tmpl_id','=',line.product_id.product_tmpl_id.id),('name','=',purchase_order.partner_id.id)],limit=1)
line.product_code=supplier_info.product_code
product_code=fields.Char(compute="get_supplier_code",store=False,string="purchase Code")
这可能对你有帮助。