Hi All,
I am trying to write a custom module that allows products to only be purchased by a specific customer. I added a customer field to the Products form, but I don't know how to compare that to the customer field in a Sales Order. I assume that it is going to be modifying the search() function in product.product but I don't know how to compare the two fields. Can anyone help? Thanks!
prakash - this is what my .xml file contains now, is this correct?
<record id="view_res_sale_line_form1" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="name">sale.order.line.form.inherit</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="replace">
<field name="product_id" domain="[('id','in',parent.custproduct_id)]"/>
</xpath>
<xpath expr="//tree/field[@name='product_id']" position="after">
<field name="custproduct_id" invisible="1"/>
</xpath>
</field>
</record>
<record id="view_res_sale_cust_domain" model="ir.ui.view">
<field name="name">res.sale.cust.domain</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="model">sale.order.line</field>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='name']">
<field name="product_id" domain="[('id','in',parent.custproduct_id)]" />
<xpath expr="//tree//field[@name='product_id']" position="after">
<field name="custproduct_id" invisible="1"/>
</xpath>
</xpath>
</field>
</record>