how to hide Edit button for a specific group - odoo-11

I'm using Odoo version 11 and I want to hide Edit button for some groups in this case group attendance/manual attendance. How can I do it?

you can done this by creating a security file in your module 'ir.model.access.csv'
1.id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2.access_hr_attendance_manual_id,access_hr_attendance_manual,model_hr_attendance,hr_attendance.group_hr_attendance,1,0,0,0

<record id="inherit_attendance_view_form" model="ir.ui.view">
<field name="name">attendance.form</field>
<field name="model">attendance</field>
<field name="inherit_id" ref="attendance."/>
<field name="groups_id" eval="[(6, 0, [ref('base.group_system') ])]"/><tree edit=false/>
</record>

Related

Odoo's qweb groups_id

With Odoo's Qweb, i wanna apply a restriction into actions.
I wanna remove some contacts into list with 'is_b2c' is True.
<record id="action_contacts" model="ir.actions.act_window">
<field name="name">Contacts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="search_view_id" ref="base.view_res_partner_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your contacts directory.
</p><p>
Odoo helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
The restriction must be:
<record id="contacts.action_contacts" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">
[
('is_b2c','=', False) <!-- Get contacts with 'is_b2c' is False for -->
]
</field>
<!-- for this group name only -->
<field name="groups_id" eval="[(6,0,[ref('sales_team.group_sale_salesman')])]"/>
</record>
Thanks
Instead of adding a group on the action, create two separate menu items and also create two separate actions and then add groups on these menu items. On one of the actions add the domain to show only limit contacts.

How to add "Group By" to Tree View in Odoo V11?

I am new in odoo.
I have a tree view , i want to show it by default with grouped by according to my stage_id.
Any one help me.
Thanks
<field name="name">dmr.search.view</field>
<field name="model">model.name</field>
<field name="arch" type="xml">
<search string="DMR">
<filter name="group_customer_id" string="Customer" icon="terp-partner" context="{'group_by':'field_name'}"/>
</search>
</field>
After adding search record, you need to add search_view_id in action.
For Ex :-
In action
<field name="search_view_id" ref="dmr_search_view"/>
I hope it works for you

Odoo 10 - Qweb PDF report header_spacing and margin_top properties

I am defining my own report.paperformat. I am trying differnet configurations for margin_top and header_space but I can not manage to undersand what does each parameter.
When a given value is used inmargin_top and header_space, which are the units being used by wlkhtmltopdf?
What are exactly each value?
A value of 15 in margin_top and a value of 5 is used in header_line, what does that mean?
Please see below image.
if you increase the Header spacing you also need to adjust the top margin as well. above image was using
Top Margin (mm) = 40.00
Header Spacing = 35.00
hope this helps to understand Top Margin and Header Spacing parameter!
For more add this to your report.
<record id="paperformat_sales" model="report.paperformat">
<field name="name">A4 Sale Order</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">8</field>
<field name="margin_bottom">0</field>
<field name="margin_left">3</field>
<field name="margin_right">0</field>
<field name="header_line" eval="False" />
<field name="header_spacing">5</field>
<field name="dpi">90</field>
</record>
<record id="action_sale_order" model="ir.actions.report.xml">
<field name="paperformat_id" ref="your_module_name.paperformat_sales"/>
</record>

Odoo res.groups Boolean instead of Dropdown

i have developed a custom module and in that custom module i am trying to give my own access rights.
for that purpose i have created a xml with access groups and a csv that specifies appropriate access right now all this is working quite fine
But i want the selection of access right to not be a dropdown but a boolean select field that lets me choose which level i would like to assign
<record id="group_user" model="res.groups">
<field name="name">Executive</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="category_id" ref="my_module.module_management"/>
</record>
now i get a dropdown on the user page in application however i would like for this to show below it in a boolean group
I show one example to how the boolean field is work in group
create a gruoup category A
<record model="ir.module.category" id="module_category_a">
<field name="name">A</field>
<field name="sequence">10</field>
</record>
Add manager group to the category A. Automatically checks the manager group
<record id="group_a_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="module_name.module_category_a"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
Add user group to category A.
<record id="group_a_user" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="module_name.module_category_a"/>
</record>
This will shows the groups manager and user under A.
There is a boolean field option for both user and manager.

How to group or nest a tree view by a field in Odoo?

I want to create a nested tree view grouping by fields like the following image.
I did not find any source code within Odoo. How to do it?
When you create a search view with a group_by you can see the lines like that
<record id="view_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.select</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<search string="Search Invoice">
<filter string="Period" context="{'group_by':'period_id'}"/>
</search>
</field>
</record>
You must select it in the search view

Resources