This question has been flagged
2 Replies
4585 Views

Hi All, 

I have deployed Odoo 9 Community Edition on my own server and am working through configuring everything we need.  So far, so good, however my sales manager wants to set visibility of the margin on quotations and reports to be visible only to users given the Sales Manager role.

Is this possible?  I've noticed that there are a lot of useful looking capabilities under the developer mode view --> Access Controls List

I'm wondering if its possible to use that to restrict visibility of the margin data by role?

Specifically, we have (currently just 1) users with 'Sales Manager' set on their access rights, which should be the only people to see margin fields on quotations and reports.

The setting to turn margins on currently, (from Sales-->Configuration-->Settings-->Margins) is binary, either everyone can see the margins (which is not what we want), or no-one can see them (also not what we want!).

Let me know if there is any other information I can provide!

Avatar
Discard
Author Best Answer

I figured it out. The code to support margin display in quotations and sales reports is held in: addons/sale_margin


In there is a sale_margin_view.xml, which defines the fields in various parts of the user interface.  By default this view sets visibility to the user group, which is all Odoo users.  Adjusting this to `base.group_sale_manager` and restarting odoo resulted in the margin fields only being displayed when logged in with a user who is a member of the sales manager group (has the manager permission in their user access settings).


Hopefully this is helpful to others that get here.


Useful references:

https://www.odoo.com/documentation/9.0/reference/views.html

Avatar
Discard
Best Answer

even though this answer is quite far into the future, the most viable option is not by compromising the source code so its better to inherit the original view of the odoo source code.

you should make an inherited view to the sale.order form and paste the code below

  

"code in comment section"

the base.group_system refers to the administrator/system group. 


cheers

Avatar
Discard

<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/group[@name='note_group']/group[@name='sale_total']/div[1]/field[@name='margin']" position="attributes">
<attribute name="groups">base.group_system</attribute>
</xpath>
<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/group[@name='note_group']/group[@name='sale_total']/label[1]" position="attributes">
<attribute name="groups">base.group_system</attribute>
</xpath>