I try to figure how I can show a restricted list of orders, purchases or invoice based on a field I added in the product model, stock_owner_id. He should see only records related to his allowed_stock_owner_ids.
Am I forced to copy stock_owner_id from product.template to sale.order.line to sale.order to apply my domain filter? Is there another way around?
Here are my models:
class User(models.Model):
_inherit = 'res.users'
current_stock_owner_id = fields.Many2one('res.partner', string='Current Stock Owner')
allowed_stock_owner_ids = fields.Many2many('res.partner', 'res_partner_users_rel',
string='Stock Owners',
domain="[('stock_owner','=',True)]")
class ProductTemplate(models.Model): _inherit = 'product.template' stock_owner_id = fields.Many2one('res.partner', string='Stock Owner', domain="[('stock_owner','=',True)]")
you may need to provide domain in a RETURN.... which returns a model ,say 'purchase.order' and define that domain based on your condition
Abdul, can you give an example?
please check the question that i have asked "pass filtered purchase orders"...
That doesn't help me at all sorry. I don't see the link between your case and mine. My ultimate goal is to create record rules...