i get this error everytime i want to add a new line in stock.move.line
'qty_qty': line.qty_qty, UnboundLocalError: local variable 'line' referenced before assignment
here is my code
qty_qty = fields.Float('Quantity', compute="_multiplication_qty")
def _multiplication_qty(self): for order in self: qty_qty = 0.0 for line in order.picking_id.move_line_ids_without_package: weight = line.product_id.weight if line.qty_done: line.qty_qty = (line.qty_done * 100) / weight order.update({ 'qty_qty': line.qty_qty,
})
~~~~~~~~~/xml~~~~~~
<record id="view_stock_mov" model="ir.ui.view">
<field name="name">stock.inherit</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/> <field name="arch" type="xml">
<xpath expr="//field[@name='lot_id']" position="after">
<field name="qty_qty" />
</xpath>
</field>
</record>