Hi everybody,
im new at odoo development so please help me a litle with this:
i already have the lot selection working in the sale order, but lot with i need to remove of the selection lot with 0 on quantity
im tried filtering in the domain, but is not working
the code is the next
.py
from odoo import api, fields, models, _
class SaleOrderLine(models.Model): _inherit = 'sale.order.line'
x_lot_id = fields.Many2one('stock.production.lot', 'Lot', copy=False)
def _prepare_procurement_values(self, group_id=False):
res = super(SaleOrderLine, self)._prepare_procurement_values(group_id=group_id)
res['x_lot_id'] = self.x_lot_id.id
return res
and the views is the next
<?xml version="1.0" encoding="utf-8"?><odoo>
<record id="view_order_tree_lot" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="after">
<field name="x_lot_id" domain="[('product_id','=', product_id),('product_qty.quantity', '>', 0.0)]" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/>
</xpath> <xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']" position="after"> <field name="x_lot_id" domain="[('product_id','=', product_id),('product_qty.quantity', '>', 0.0)]" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/> </xpath> </field>
</record>
Please give me an advice
Thank you
Thank you for the quick answer, i tried make the change but odoo give me the next error
ERROR odootest odoo.osv.expression: Non-stored field stock.production.lot.product_qty cannot be searched.
any ideas?
thank you again
[["quant_ids.quantity",">",0]]