Odoo: How To Search A Parent_id And Its All Child In Product.category
I want to, when the user selected (through Many2one field) a category, I need to find its related parent_id for Brands to add a domain filter on another Many2one field to have rela
Solution 1:
@SDBot, the xml code for this particular model is here...
<notebook><pagestring="Order Items"><fieldname="order_ids"><treeeditable="bottom"string="Order Items"><fieldname="store_id"/><fieldname="categry_id"/><fieldname="items_id"/><fieldname="categ_name"/><fieldname="brand_id"/><fieldname="unit_id"/><fieldname="quantity"/></tree></field></page></notebook>
Model where added a field categ_name and a domain in brand_id
class OrderItems(models.Model):
_name = 'tests.orderitems'
_description = "Tests Order Items"
store_id = fields.Many2one('tests.stores', string="Store", ondelete='cascade')
order_id = fields.Many2one('tests.testsorders')
categry_id = fields.Many2one('product.category', string="Category",
domain="[['complete_name', 'not like', '%Brands%']]")
items_id = fields.Many2one('tests.storeitems', string="Item",
domain="[['categs_id', '=', categry_id]]")
categ_name = fields.Char('Category Name', related='categry_id.complete_name')
brand_id = fields.Many2one('product.category', string="Brand",
domain="[('complete_name', 'like', categ_name),('complete_name', '!=', categ_name)]")
unit_id = fields.Many2one('tests.units', string="Unit")
quantity = fields.Integer(string="Quantity", required=True, default=1)
rates = fields.Float(string="Rate", default=0)
size = fields.Char(string="Size")
Post a Comment for "Odoo: How To Search A Parent_id And Its All Child In Product.category"