Skip to content

Commit

Permalink
[FIX] account, sale_timesheet: access rights when validating invoice
Browse files Browse the repository at this point in the history
When validate an invoice, if the user is member of the timesheet user
group and the billing user group, it is forbidden to create an analytic
line without a project set. The previous commit (81218a8) allow the user
to create an analytic account line by adding a record rule in the
sale_timesheet module.

If only the account and timesheet modules' are installed, before this
commit, an error was raised when trying to validate an invoice in the
account module. This issue occurs because the record rule to allow the
user to create an analytic account line is found in sale_timesheet
module, and this one is not installed.
As an invoice can be validated without the need of the sales module's,
from the purchase module, or directly in the account module.
In this commit, the record rule was move to the account module.

opw-1948132

closes #31661

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
  • Loading branch information
alt-odoo authored and jpp-odoo committed Apr 10, 2019
1 parent f1d0f2a commit 49eb24a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 11 additions & 0 deletions addons/account/security/account_security.xml
Expand Up @@ -59,6 +59,17 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="account_analytic_line_rule_billing_user" model="ir.rule">
<field name="name">account.analytic.line.billing.user</field>
<field name="model_id" ref="analytic.model_account_analytic_line"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
<field name="perm_read" eval="0"/>
</record>

</data>


Expand Down
11 changes: 0 additions & 11 deletions addons/sale_timesheet/security/sale_timesheet_security.xml
Expand Up @@ -3,17 +3,6 @@

<data noupdate="1">

<record id="account_analytic_line_rule_billing_user" model="ir.rule">
<field name="name">account.analytic.line.billing.user</field>
<field name="model_id" ref="analytic.model_account_analytic_line"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
<field name="perm_read" eval="0"/>
</record>

<record id="sale_order_line_rule_project_manager" model="ir.rule">
<field name="name">Project Manager Sales Orders Line</field>
<field name="model_id" ref="sale.model_sale_order_line"/>
Expand Down

0 comments on commit 49eb24a

Please sign in to comment.