Skip to Content
Menu
This question has been flagged
2 Replies
9210 Views

Hi, I'm not sure if what I'm doing is possible. I have extended the product type to include a relationship to optional prices, we're calling them BundlePriceOptions. The price options each have an fkey to product, so each product has a range of possible price options. I'm trying to alter the sale form so that on the sale order line, if one chooses a product, there is a pulldown with the list of possible price options, and that list should only contain options pertinent to the product currently selected. I thought I could do something like this:

<record id="view_order_form" model="ir.ui.view">
      <field name="name">sale.order.form</field>
      <field name="model">sale.order</field>
      <field name="priority">1</field>
      <field name="inherit_id" ref="sale.view_order_form"/>
      <field name="arch" type="xml">
          <field name="user_id" position="after">
          </field>
          <tree string="Sales Order Lines" position="inside">
            <field 
               name="bundle_price_option" 
               string="Pricing Options"  
               widget="selection"   
               domain="[ ('product_id', '=', product_id) ]" 
               on_change="price_option_change(bundle_price_option, context)"
             />
          </tree>
       </field>
     </record>

But when I do this, I can't out what should go in the right hand side of the domain filter tuple. I'd like it to evaluate dynamically to the id of the currently selected product on the sale order line. It works if I put a static value in there (like an int of a product id), but whatever I put in there seems to give me a traceback of being undefined. If anyone can tell me what I should try or if I'm event approaching this correctly that would be great.

Thanks Iain

Avatar
Discard
Best Answer

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

Avatar
Discard
Best Answer

Hello,

Try to remove the widget="selection" in the field tag ...

Also another option you can override the function product_id_change in the sale_order_line

to add 'domain' to your custom field ...

I hope it'll help,


Regards,

Avatar
Discard
Related Posts Replies Views Activity
3
Sep 20
71547
1
Sep 19
2846
2
Dec 23
31989
1
Aug 23
1561
1
Apr 22
2105