简体   繁体   English

从 Odoo 15 中的 product.template 添加手头数量和产品供应商到销售订单行

[英]Add quantity on hand and the suppliers of product to sale order lines from product.template in Odoo 15

Products in odoo have informations like name,type,price,Internal Reference ect.. odoo 中的产品具有名称、类型、价格、内部参考等信息。

在此处输入图像描述

here I want to add quantity on hand and the suppliers of a product in sale order lines Sale Order Lines在这里我想在销售订单行 Sale Order Lines 中添加手头数量和产品供应商在此处输入图像描述 as you see in the picture we have in order lines product,description,qty,price ect.. i want to add quantity on hand and the suppliers to this infos.正如您在图片中看到的,我们有订单行产品、描述、数量、价格等。我想添加手头数量和供应商到此信息。

how can i add quantity on hand from image 1 (product) to image 2 (Order lines), and the suppliers too我如何将图像 1(产品)中的现有数量添加到图像 2(订单行)以及供应商

i tried this code我试过这段代码

qty_on_hand = fields.Char(related="product_id.qty_available")

but i got this error但我得到了这个错误

odoo type of related field sale.order.line.qty_on_hand is inconsistent with product.product.qty_available相关字段sale.order.line.qty_on_hand的odoo类型与product.product.qty_available不一致

what is suppliers explain that please.suppliers解释一下是什么。 i mean what will that field contain.. and for the quantity available you are doing it a bit wrong.我的意思是该字段将包含什么……对于quantity available您做的有点不对。 see the code below... you have to do like this...看下面的代码......你必须这样做......

inherit sale.order.line and add a field继承sale.order.line 增加一个字段

qty_on_hand = fields.Float('On Hand Qty', related='product_id.qty_available')

add this qty_available field in xml by inheriting the the order_lines view thats all for on hand quantity .通过继承on hand quantity的 order_lines 视图,在 xml 中添加此 qty_available 字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM