i want to display only the products that has as a status = 'qualifid' when i am creating a new sales order in the sales.order.lines form
for this i added the new selection field in the product.template model
_inherit = "product.template" state = fields.Selection([ ('scratch', 'Brouillion'), ('qualifid', 'Qualifié'), ('valide', 'Validé'), ], setting='State', readonly=True, default='scratch')
i added the field to the correspanding view
<record id="view_product_template_tech_inherit" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="/form/header/button" position="after">
<field name="state" widget="statusbar"/>
</xpath>
</field>
</record>
and then i try to set the product_id in with this domaine
<record id="view_sale_order_tech_inherit" model="ir.ui.view">
<field name="name">tech.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath
expr="//page[@name='order_lines']/field/form/group/group/field[@name='product_id']" position="replace">
<field name="product_id" domain="[('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id), ('state', '!=', 'scratch')]"/>
</xpath>
</field>
</record>
but it seems something still missing