Skip to Content
Menu
This question has been flagged
4 Replies
527 Views

Hello,

I'm encountering an issue in Odoo 17 related to invoice validation.

When a user is assigned to the group "Only Own Documents" group for accounting, the "Validate" button does not appear on invoices and the invoice remains in draft state until I validate it (as I have the validate button). If I give to the same user the right "All documents" then the "Validate" button appear on the invoice.

Could you please help me to allow users with the "Only Own Documents" right group to see and use the "Validate" button, but only for the invoices they are allowed to manage (for example, invoices they created or that are assigned to them).

Any guidance or suggestions would be greatly appreciated!

Thanks in advance for your help.

Avatar
Discard
Best Answer

Thanks for the clear steps! This will help a lot in managing invoice access and validation.

Avatar
Discard
Best Answer

Hi,

You can use the following code to give the user access to the 'Validate' button.


<xpath expr="//button[@name='action_post']" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>


By using the above code, we can change the attribute of a button in any model.


To get the button name, enable the developer mode, bring the cursor to the button, and hover over the name of the particular button.


The user group can be fetched as follows.


Hope it helps

Avatar
Discard
Author

Hi,

Thank you, I will try it.

But could you please tell me where should I specify the above code ?

<xpath expr="//button[@name='action_post']" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</xpath>

Author Best Answer

Hi  and thank you for your answer.


But I don't see any rule with the name Account Move: only see own documents (account.move)

Should I create a new rule ?

Thanks

Avatar
Discard
Best Answer

Step 1: Modify the Record Rule for "Only Own Documents"

Go to: Settings → Technical → Security → Record Rules

Search for this rule:

Account Move: only see own documents (account.move)

Edit the domain: 

['|', ('create_uid', '=', user.id)]


This allows them to access invoices they:

  • Created (create_uid)
  • Are assigned to (user_id)

If you're using a custom field (like salesperson_id), adjust the domain accordingly.

Step 2: Update Access Rights if Needed

  • Now go to: Settings → Technical → Security → Access Control Lists
  • Search for the ACL related to account.move and ensure that the "Only Own Documents" group has at least:


  • Read
  • Write: (Required to validate!)
  • Create
  • Delete: (optional, safer to keep off)


Step 3: Confirm in UI

  • Login as that user.
  • Go to Customer Invoices.
  • Open an invoice they created.
  • You should now see the Validate button.

They won’t see the button on invoices created by others.

Important Notes

  • The Validate button calls action_post, which requires write access on the invoice.
  • If you have custom modules or workflows (e.g., Salesperson approval), make sure they don’t interfere.


Thanks & Regards,

Company :- DataInteger Consultancy Services LLP

Avatar
Discard
Related Posts Replies Views Activity
2
Jan 23
4354
12
Jan 17
13651
2
Apr 16
3782
1
Mar 15
8861
3
Mar 15
5490