Hello Julien Cour,
1)For restricting customers to the area of users, you can create something like this:
First, add a field in the users for the states allowed to the user.
class Users(models.Model):
_inherit = 'res.users'
allowed_states = fields.Many2many('res.country.state', string="Allowed States", help="User will only see clients and Sale Orders of this states.")
Then in the search method for the partners add this code...
this will check that only those partners are visible to the current users whose state is present in the allowed states for the current users.
class ResPartner(models.Model):
_inherit = 'res.partner'
def search(self, args, **kwargs):
state_ids = self.env.user.allowed_states.ids
for arg in args:
if arg[0] == 'customer' and arg[2] == True:
args += [('state_id', 'in', state_ids)]
return super(ResPartner, self).search(args, **kwargs)
2)For restricting the rights to the 'Confirm' button, you can simply create a group and apply that to the 'Confirm' button of the Sales Orders. So only the users with access to that group would be able to see the 'Confirm' button.
Thanks
For more information Contact us :- https://kanakinfosystems.com/odoo-development-services