Help

2

How to filter a view where column = another_column (in the same table)?

Avatar
Bruno F

Hi everyone, 

I'm using Odoo 9 and i want to filter all the sale.order where the qty_invoiced is equal to the 'product_uom_qty'.

i tried in the xml : to use the domain like this :

"domain": [('qty_invoiced','=','product_uom_qty')],


But the code fail and i have this kind of error :

    ValueError: could not convert string to float: product_uom_qty


In a sale.order.line view, i saw that the filter don't allow to select another column so how can i do that ?

Thanks in advance for your answers


Here is the complete xml sample about this view

<record model="ir.actions.server" id="action_orders_lines_not_invoiced">
<field name="name">Sale.order lines not Invoiced</field>
<field name="model_id" ref="sale.model_sale_order_line"/>
<field name="code">
action = {
"type": "ir.actions.act_window",
"name": "Sale.order lines not Invoiced",
"view_mode": "tree",
"res_model": "sale.order.line",
"views": [[False, "tree"], [False, "form"]],
"domain": [('qty_invoiced','=','product_uom_qty')],
"context": "{'show_sale': True, 'group_by': 'order_id'}"
}
</field>
</record>

<menuitem action="action_orders_lines_not_invoiced" id="menu_sale_order_lines_not_invoiced" parent="sale.menu_sale_invoicing" sequence="3"/>
Avatar
Discard
1 Answer
0
Avatar
Zbik
Best Answer

You replace:

"domain": [('qty_invoiced','=','product_uom_qty')],

by

"domain": [('qty_invoiced','=',product_uom_qty)],

Avatar
Discard