New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP]hr_expense: Allow changes (or not) depending on the stage #32918
Conversation
7ecf96b
to
7ccf540
Compare
7ccf540
to
cbebc9c
Compare
cbebc9c
to
00bba4c
Compare
00bba4c
to
bb33a01
Compare
bb33a01
to
2199be3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should use ir.rules instead of groups on some of the fields
@@ -28,6 +28,7 @@ | |||
<record id="group_account_user" model="res.groups"> | |||
<field name="name">Show Full Accounting Features</field> | |||
<field name="category_id" ref="base.module_category_hidden"/> | |||
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why it is tempting to try and fix the access rights problem you get in your code by giving the group_account_user
to user_root and user_admin, but this does not actually fix the problem.
- It will change the behaviour of the whole community accounting, which is not what the task is about
- It will "fix" the problem on runbot by hiding it under the carpet, but if you create a new user and give it the account_manager right, he will face the access right issue
I agree that the way groups and access rights are handled by the accounting module is a bit weird but we have to work with it being like that.
A proper fix for this issue is to check if the user has either group_account_manager
or group_account_user
instead of checking only the group_account_user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed this group should not be granted to a user in the community version ;)
@tivisse This one can probably be merged |
2199be3
to
37e4107
Compare
37e4107
to
bbcfdb4
Compare
Purpose ======= When an Expense report hits the "Approved" stage, the Accountant can no longer edit the account / tax / analytic account fields. However, this information can still be modified from the Expense itself, impacting directly the related Expense report anyway. In any case, it makes sense for an accountant to be able to edit this type of information, as it is likely that an employee or a manager will input the wrong accounts. On the other hand, once the Journal entries are posted, the Expense report should not be editable anymore. Specifications ============== For the Expense report (hr.expense.sheet model): If the report is in the "Approved" stage AND the user has at least the Accounting / Accountant access right level The following fields should be editable - Taxes (tax_ids) - Bill reference (reference) - Account (account_id) - Analytic account (analytic_account_id) If the user has a lower access right level => the fields listed above remain in read only. If it is in the "Posted" stage (regardless of the access right level of the user): The following fields should be in read only: - Taxes (tax_ids) - Account (account_id) - Analytic account (analytic_account_id) The "Bill reference" (reference) field should still be editable (current behavior). Based on the Expense report's stage and the access right level of the user, the fields of the related Expenses should also be editable (or not).
bbcfdb4
to
fd06878
Compare
@robodoo r+ |
Purpose ======= When an Expense report hits the "Approved" stage, the Accountant can no longer edit the account / tax / analytic account fields. However, this information can still be modified from the Expense itself, impacting directly the related Expense report anyway. In any case, it makes sense for an accountant to be able to edit this type of information, as it is likely that an employee or a manager will input the wrong accounts. On the other hand, once the Journal entries are posted, the Expense report should not be editable anymore. Specifications ============== For the Expense report (hr.expense.sheet model): If the report is in the "Approved" stage AND the user has at least the Accounting / Accountant access right level The following fields should be editable - Taxes (tax_ids) - Bill reference (reference) - Account (account_id) - Analytic account (analytic_account_id) If the user has a lower access right level => the fields listed above remain in read only. If it is in the "Posted" stage (regardless of the access right level of the user): The following fields should be in read only: - Taxes (tax_ids) - Account (account_id) - Analytic account (analytic_account_id) The "Bill reference" (reference) field should still be editable (current behavior). Based on the Expense report's stage and the access right level of the user, the fields of the related Expenses should also be editable (or not). closes #32918 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Merged, thanks! |
Description of the issue/feature this PR addresses:
When an Expense report hits the "Approved" stage, the Accountant
can no longer edit the account / tax / analytic account fields.
However, this information can still be modified from the Expense
itself, impacting directly the related Expense report anyway. In
any case, it makes sense for an accountant to be able to edit
this type of information, as it is likely that an employee or a manager
will input the wrong accounts. On the other hand, once the Journal
entries are posted, the Expense report should not be editable anymore.
Desired behavior after PR is merged:
If the report is in the "Approved" stage
AND the user has at least the Accounting / Accountant access right level
The following fields should be editable
Taxes (tax_ids)
Bill reference (reference)
Account (account_id)
Analytic account (analytic_account_id)
f it is in the "Posted" stage (regardless of the access right level of the user):
The following fields should be in read only:
Taxes (tax_ids)
Account (account_id)
Analytic account (analytic_account_id)
The "Bill reference" (reference) field should still be editable (current behavior).
id=1965890
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr