Say I want to make the product_uom field (many2one) of sale.order.line dependent on the field shop_id (also many2one) of sale.order. I choose a shop and I'm allowed to use certain pre-defined product_uom's for that particular shop without saving the sale.order in the process.
How do I make this happen? How can I filter the options of a dropdown based on another field's value?
I have already created the connections between shop_id and product_uom using a many2many field. This would probably be a lot easier if the filtered field was in the same object, but in this case the field to be filtered is in sale.order.line and the "master field" is in sale.order.
I tried an on_change method, but I couldn't figure out how to apply the domain change for a different object's field. I also tried to set the domain of the product_uom field to point to the shop_id's connection field (ie. the many2many field) without success.