I'm facing some problem with Many2one field when pass domain attributes in view.
This is my model
class Product(models.Model):
_name = 'product'
store_id = fields.Many2one('store', string='Store')
class Store(models.Model):
_name = 'store'
product_ids = fields.One2many('product', 'store_id')
class Order(models.Model):
_name = 'order'
store_id = fields.Many2one('store', string='Store')
order_line = fields.One2many('order.line', 'order_id')
class OrderLine(models.Model):
_name = 'order.line'
order_id = fields.Many2one('order', string='Order')
product_id = fields.Many2one('product', string='Product')
number = fields.Integer(string='number')
This is my view
< record id="order_form" model="ir.ui.view">
< field name="name">order.form
< field name="model">order
< field name="arch" type="xml">
< form string="Property">
< field name="store_id" widget="Many2one"/>
< field name="order_line" widget="one2Many">
< tree editable="bottom">
< field name="product_id"
widget="many2one"
domain="[('store_id', '=', 'order.store_id')]"/>
< field name="number"/>
< /tree>
< /field>
< /form>
< /field>
< /record>
What I want is when adding order line in order form,
the product that can be selected is the product which has same store as the store field in order form.
But as my code, the only product I can get is nothing from the drop down selection.
Didn’t know which part get wrong.
Can anyone help please.
Thank a lot.