Skip to Content
Menu
This question has been flagged
1751 Views

Hi,

please i need your help to add field contains the real quantity on stock.picking from the original purchase order (purchase.order.line)

I can print the result on terminal using pycharm, but i can't see it on odoo

I've added a button get_data to testing

I also tried with api.depends but i can't get the result .. and there's no error message

here's the code .py


def get_data(self):
x = self.purchase_id.id
po_lines = self.env['purchase.order'].search([('id', '=', x)])
list_real_qty = []
for rec in po_lines:
    for data in rec.order_line:
        self.real_qty = data.product_qty
list_real_qty.append(data.product_qty)
print(list_real_qty)

.xml

<record id="stock_picking_inherit" model="ir.ui.view">
<field name="name">stock.picking.inherit</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<header position="inside">
<button class="btn-primary" name="get_data" type="object"
string="Get Data"/>
</header>
</field>
</record>
Avatar
Discard