Skip to content
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

[FIX] mrp_account: bypass the timesheet analytic access rule for MRP #162409

Conversation

lase-odoo
Copy link
Contributor

Steps to reproduce:

  • Go to settings and activate Analytic Accounting
  • Create a product with a BOM
  • In the Miscellaneous tab of the BOM, add: [ASML - HOUR] Costing Account For Hours of Assembly as analytic account.
  • Settings > Users and companies > Users
  • Change the access rights of Marc Demo to:
    • Timesheets: User: own timesheets only
    • Accounting: None
  • Connect as mark Demo and create an manufactoring order with your BOM
  • "Confirm" the MO and "Mark as Done":

> Access Error: you are not allowed to modify 'Analytic Line'

Cause of the issue:

The error is raised due to the ir.rule:
"account.analytic.line.timesheet.user.update-unlink": https://github.com/odoo/enterprise/blob/c5ab16b0464cc396fdb02f3968d3d61e68f7cb2e/timesheet_grid/security/timesheet_security.xml#L12-L28
as the analytic lines created from the MO will not be linked to a project and will therefore never pass the domain.

opw-3836624

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Apr 18, 2024

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Apr 18, 2024
@lase-odoo lase-odoo force-pushed the 15.0-opw-3836624-mark_done_MO_with_analytic_account-lase branch 3 times, most recently from 47ca614 to 7fe2819 Compare April 25, 2024 15:07
Copy link
Contributor

@nle-odoo nle-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good to me if mrp_user needs this right

@@ -4,6 +4,7 @@
from odoo.addons.mrp.tests.common import TestMrpCommon
from odoo.addons.stock_account.tests.test_account_move import TestAccountMove
from odoo.tests import Form, tagged
from odoo import Command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be first of the from odoo normally

@lase-odoo lase-odoo force-pushed the 15.0-opw-3836624-mark_done_MO_with_analytic_account-lase branch from 7fe2819 to 97e1e13 Compare April 29, 2024 13:29
@lase-odoo lase-odoo marked this pull request as ready for review April 29, 2024 13:30
@C3POdoo C3POdoo requested a review from a team April 29, 2024 13:31
@Whenrow
Copy link
Contributor

Whenrow commented Jun 5, 2024

I would sudo() the part about analytics in button_mark_done() instead

@lase-odoo
Copy link
Contributor Author

@Whenrow the error is actually raised when the action returned by the button_mark_done() is processed. Should I really add a super user in the context of the action ?

@lase-odoo lase-odoo force-pushed the 15.0-opw-3836624-mark_done_MO_with_analytic_account-lase branch from 97e1e13 to 3c52509 Compare June 6, 2024 07:14
…flows

Steps to reproduce:
- Go to settings and activate Analytic Accounting
- Create a product with a BOM
- In the Miscellaneous tab of the BOM, add:
  [ASML - HOUR] Costing Account For Hours of Assembly
  as analytic account.
- Settings > Users and companies > Users
- Change the access rights of Marc Demo to:
  - Timesheets: User: own timesheets only
  - Accounting: None
- Connect as mark Demo and create an manufactoring order with your BOM
- "Confirm" the MO and "Mark as Done":

> Access Error: you are not allowed to modify 'Analytic Line'

Cause of the issue:

The error is raised due to the ir.rule:
"account.analytic.line.timesheet.user.update-unlink":
https://github.com/odoo/enterprise/blob/c5ab16b0464cc396fdb02f3968d3d61e68f7cb2e/timesheet_grid/security/timesheet_security.xml#L12-L28
as the analytic lines created from the MO will not be linked to a
project and will therefore never pass the domain.

opw-3836624
@lase-odoo lase-odoo force-pushed the 15.0-opw-3836624-mark_done_MO_with_analytic_account-lase branch from 3c52509 to 511fd3c Compare June 6, 2024 07:15
@Whenrow
Copy link
Contributor

Whenrow commented Jun 6, 2024

robodoo r+

robodoo pushed a commit that referenced this pull request Jun 6, 2024
…flows

Steps to reproduce:
- Go to settings and activate Analytic Accounting
- Create a product with a BOM
- In the Miscellaneous tab of the BOM, add:
  [ASML - HOUR] Costing Account For Hours of Assembly
  as analytic account.
- Settings > Users and companies > Users
- Change the access rights of Marc Demo to:
  - Timesheets: User: own timesheets only
  - Accounting: None
- Connect as mark Demo and create an manufactoring order with your BOM
- "Confirm" the MO and "Mark as Done":

> Access Error: you are not allowed to modify 'Analytic Line'

Cause of the issue:

The error is raised due to the ir.rule:
"account.analytic.line.timesheet.user.update-unlink":
https://github.com/odoo/enterprise/blob/c5ab16b0464cc396fdb02f3968d3d61e68f7cb2e/timesheet_grid/security/timesheet_security.xml#L12-L28
as the analytic lines created from the MO will not be linked to a
project and will therefore never pass the domain.

opw-3836624

closes #162409

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
@robodoo robodoo closed this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants