Closed mayur-patel closed 9 years ago
@rmehta I know you guys are busy with very high priority issues/bugs and also with upcoming conference. Is this request very hard? If not, could you please look into resolving this? Thanks.
Mayur Patel
@mayur-patel the system shouldn't set the default company if there are 2 companies in the user permissions. Are you able to reproduce this in a system without any customization?
@anandpdoshi Thanks Anand for your reply.
See in our ERPNext implementation we have 7 companies. There are 22 users who can raise PO for more than 1 companies. I am one of them. I raise IT related PO for all of these companies and in my user permissions I have 7 companies. Other user may only raise PO for 2 or 3 companies. So I have assigned them to more than 1 companies as per our requirement.
But in their employee record, we only store the company they are employed under. Also for each of the user we have setup their leave approver in their employee record. One employee only has one leave approver and it is setup again in their Employee record. Hence it make sense to set company and leave approver on Leave Application page as per the employee field. This used to work in ERPNEXT Version 3.0. But it is broken in the latest version since the user property feature has been removed. What we wanted was some way to set company and Leave approver when user clicks on Add new Leave application automatically. Since Employee is already selected by default (which is good), add_fetch events are not getting fired. We need some mechanism by which we can fire add_fetch without User selecting their Employee (name) again.
Please let me know if above doesn't make sense.
Kind regards, Mayur Patel
@anandpdoshi Correction: System doesn't even pick the 1st company from the user permissions. It seems to use the Default company setup for the instance. So I can't even reorder the user permission to have their correct company as 1st company in the user permissions.
@anandpdoshi
Could you please look into this when you get a chance? This is one of the two things that is holding our migration.Thanks.
Thanks Anand. I can see that when an employee logs in, the leave approver's detail is being automatically filled in based on logged in user's employee record. How do I get system to set the company field?
Pushed a fix.
Best, Anand Doshi
ERPNext
On 22-Oct-2015, at 6:14 PM, Mayur Patel notifications@github.com wrote:
Thanks Anand. I can see that when an employee logs in, the leave approver's detail is being automatically filled in based on logged in user's employee record. How do I get system to set the company field?
— Reply to this email directly or view it on GitHub https://github.com/frappe/erpnext/issues/4000#issuecomment-150209057.
Thank you so much. I just tested it and it works fine. Kind regards, Mayur Patel
Hi Anand,
I noticed that company field is not correctly being set every time. For example, if I login as a "User A" who works for "Company A" and then on leave page correct information is being displayed. Now if I logout and login back as "User B" who is working for "Company B (as per his/her employee record), the system choose "Company A" as default. Even "Reload" doesn't seems to fix it. I have to restart the server and then on reload the correct company being set for the user B. In our instance "Company A" is set as default for the whole instance.
As requested by Rushabh, I am creating this issue.
On add leave application page, the employee field is auto-selected (by default) so using add_fetch to fetch company and leave approver won't get trigger. If a user is allowed to see two companies as part of his user permission, currently system is auto selecting the first company based on the user permission for this user which may not be the correct company. The system should to set the company field based on his employee record. Also the leave approver should be based on the employee record's leave approver. Let me know if you need more information.