I have three different companies on odoo and each has a different CEO
I have a custom module for resignation approval and want to set restrictions on the CEO approval button.
The CEOs from other companies cannot approve the request for an employee who belongs to another company.
I have created a custom field CEO on the company form view and selected CEOS for all the companies.
Please help me how to set restrictions on other CEOs so they cannot accept the requests from other companies
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
you can follow these steps:
- Add a Many2one field for the CEO in your resignation approval model.
- When a CEO approves a resignation request, check if the employee's company matches the CEO's company.
from odoo import models, fields, api, exceptions
class ResignationApproval(models.Model):
_name = 'resignation.approval'
employee_id = fields.Many2one('hr.employee', string='Employee')
company_id = fields.Many2one('res.company', string='Company', related='employee_id.company_id', store=True)
ceo_id = fields.Many2one('res.users', string='CEO')
@api.multi
def action_approve(self):
for record in self:
if record.ceo_id.company_id != record.company_id:
raise exceptions.UserError("You cannot approve the resignation request for an employee from another company.")
# Add your approval logic here
This should be covered by standard authorization management. Unless your custom module override any of this.
In User access right remove access to Multi Company. (In the bottom of the screen.)
In the top of the screen, you can define allowed companies. Then they would not be able to access any registration for employees outside the company for which they have access.
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
lip 19
|
6511 | ||
[Solved] [Odoo 8.0] Multi company CRM App.
Rozwiązane
|
|
2
mar 17
|
4857 | |
|
0
maj 22
|
3207 | ||
|
0
paź 22
|
264 | ||
|
0
kwi 21
|
2999 |