Based on my products I am not getting the attribute in odoo12 community
When I select the product I want to get the attribute which is my field.
But I am getting the attribute value based on the attribute when only this condition is given in onchange
res['domain'] = {'attribute_value':[('attribute_id', '=', self.product_attribute.id)]
here is my code...
# -*- coding: utf-8 -*-
from odoo import models, fields, api
#Model of Sale-Order product variant
class SaleVariant(models.Model):
_inherit = 'sale.order.line'
product_attribute = fields.Many2one('product.attribute', string='Product Attributes')
attribute_value=fields.Many2many('product.attribute.value',string="Attribute Value")
# onchange handler
@api.onchange('product_attribute','product_id')
def _product_attribute_onchange(self):
res = {}
res['domain'] = {'attribute_value':[('attribute_id', '=', self.product_attribute.id)],
'product_attribute':[('attribute_line_ids.product_tmpl_id', '=', self.product_id.id)]}
return res
Please help...
Thanks in Advance..