I would like to filter product_id
on sale.order.line
.
Let me explain,
I have a model:
class MyModel(models.Model):
_name = 'my.model'
order_id = fields.Many2one('sale.order', string="Sale Order", )
product_id = fields.Many2one('product.product', string="Settlement", domain='')
On sale.order
:
class SalesOrder(models.Model):
_name = 'sale.order'
_inherit = 'sale.order'
my_model_id = fields.One2many('my.model', 'order_id', string="My model")
I have a tree view
for MyModel
model on SaleOrder
view, something like the tree view of sale.order.line
, an additional line we could say.
But, on my model (MyModel), I would like to filter product_id
by the items created on the current sale.order
.
MyModel, serves to create a different product which is not on the sale.order.line
already, and it has it's own treeview, like sale.order.line
does.
I don't know if I'm explaining well,
I create a product from MyModel
from a sale.order
record, then I'm gonna add this recently created product to it's own tree view (which is not to say sale.order.line
one), but I must browse the products (on product_id
) created from the current sale.order
only.
Any ideas?
You can create many2many (to product.product) field insteds of creating one2many on Sales order I think then only using mana2many you can filter you sales order line products. This is just my thoughts based on your requirement.