简体   繁体   中英

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..

在此处输入图像描述

here I want to add quantity on hand and the suppliers of a product in 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

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

what is suppliers explain that please. i mean what will that field contain.. and for the quantity available you are doing it a bit wrong. see the code below... you have to do like this...

inherit sale.order.line and add a field

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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