class OrderItems(models.Model):both fields are based on model "product.category", and I want as below:
_name = 'tests.orderitems'
_description = "Tests Order Items"
order_id = fields.Many2one('tests.myorders')
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', store=True)
base_category = fields.Integer('Base Cat', related='categry_id.base_category')
brand_id = fields.Many2one('product.category', string="Brand",
domain="[('base_category', '=', base_category),('complete_name', 'like', '%Brands /%')]")
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")
Sample:
regards
Enhance the functionality of Many2One fields in Odoo with dynamic multi-field Search and Get capabilities. This app allows users to search and get records within Many2One fields using multiple fields. With a user-friendly configuration interface, you can easily specify the fields to be included in the search criteria, making it more efficient and flexible for finding records as well as displaying the records based on multiple fields instead of only name field.
https://apps.odoo.com/apps/modules/17.0/mh_dynamic_name_get_many2one