[FIX] sale_expense: Fix traceback
This could lead to a traceback in case the user's priviledge is not sufficient to make the name_search closes odoo/odoo#90687 X-original-commit: 28ad95df0807c117d3865a899a96939d0ac36e84 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -15,7 +15,7 @@ class SaleOrder(models.Model):
|
||||
@api.model
|
||||
def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
""" For expense, we want to show all sales order but only their name_get (no ir.rule applied), this is the only way to do it. """
|
||||
if self._context.get('sale_expense_all_order'):
|
||||
if self._context.get('sale_expense_all_order') and self.user_has_groups('sales_team.group_sale_salesman') and not self.user_has_groups('sales_team.group_sale_salesman_all_leads'):
|
||||
domain = expression.AND([args or [], ['&', ('state', '=', 'sale'), ('company_id', 'in', self.env.companies.ids)]])
|
||||
return super(SaleOrder, self.sudo())._name_search(name=name, args=domain, operator=operator, limit=limit, name_get_uid=SUPERUSER_ID)
|
||||
return super(SaleOrder, self)._name_search(name=name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid)
|
||||
|
||||
Reference in New Issue
Block a user