Temur, 
thanks for your time. Sadly even if without syntax errors the filter is not working at all and shows all the products:
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" domain="[('pos_categ_id', 'in', context.get('category2'))]"/> Just a note: product_id is a many2one field, not a one2many, and pos_categ_id (char) is related on pos_categ_id on product,template (many2one). 
Here is my xml:
            
            
<?xml version="1.0"?>
    <form string="Workcenter2 Orders">
                    <header>                 
                        <field name="state" widget="statusbar" statusbar_visible="draft,paid,done" statusbar_colors="{"cancel":"red"}"/>
                    </header>   
                    <sheet>
                    <group col="4" colspan="4">
                        <field name="name"/>
                        <field name="date_order"/>
                        <field name="session_id" required="1"/>
                        <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer', '=', True)]" context="{'search_default_customer':1}"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Products">
                            <field name="lines" colspan="4" nolabel="1">
                                <tree string="Order lines" editable="bottom">
                                    <field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/> 
                                    <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/>
                                    <field name="price_unit" invisible="1"/>
                                    <field name="pos_categ_id" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/>                                   
                                </tree>
                            </field>
<div class="oe_clear"/>
	<div class="col-xs-12 text-center">
		<button name="622" string="Update" class="oe_highlight" type="action" attrs="{'invisible':[('x_kot_order','=','Ready')]}" /> 
	</div>
                        </page>
                    </notebook>
                </sheet>
    </form>
And this is what the order looks like when I hide the 'pos2' category (the empty line in the middle).