How to change the default no of records displayed on OpenERP - odoo

By default, OpenERP displays 20 records when retrieving data. Is there any way I can change the default no of records to something else? I can't find it anywhere

If you want to change the limit of the items displayed in a view, you have to edit the Window Action attached to it.
Go to Settings > Technical > Actions > Window Actions (Odoo v10).
Select the action you want to change, edit and change the field Limit, for the number of records you want to display.
Alternately, with Developer Mode activated, open the view. Open Developer Tools (the bug icon) > Edit Action and change field Limit.

To change the default number of records to display in a tree view, When you define the action
add <field name="limit">your_record_limit</field>
For example, in sale order the default number of record is 80, we can change it to 150 by adding <field name="limit">150</field> to the ir.action.act_window
<record id="action_order_form" model="ir.actions.act_window">
<field name="name">Sales Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="limit">150</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
</record>

Related

Change the name of a parent menu in odoo 16

Change the name of a parent menu in odoo 16
I put this code here because it doesn't work for me. I wanted to clarify that what I want is to change the name of a menu but through code, not through the odoo interface
<record id="hr_payroll.menu_hr_payroll_payslips" model="ir.ui.menu">
<field name="name">New name</field>
</record>
What I'm trying to do is to be able to change the name of a parent menu in odoo 16, but so far the only thing I've managed to do is change the name of a sub-menu. How can I change the name of a parent menu in odoo 16? Could you help me on that part please.
your text`
<record id="menu_hr_payroll_payslips_new" model="ir.ui.menu">
<field name="name">Nómina</field>
<field name="sequence">70</field>
<field name="parent_id"
ref="hr_payroll.menu_hr_payroll_employee_payslips_to_pay"/>
<field name="action" ref="hr_payroll.hr_payslip_action_view_to_pay"/>
</record>
I tried this code and it worked for me but only to change the name of a sub-menu, but what I want is to change the name of a parent menu in odoo16`

How to access logged in user's group in a view in Odoo?

I want to show a field read-only for all users of group named Manager (having read and update rights for that model). They must not be able to update a field called 'x_name'.
I am using odoo web client (Gui) and don't have access of xml file. I am only able to use the GUI so please suggest a solution for working this out through GUI.
Go to Settings -> User Interface -> Views and create a view, give it the following contents:
<record id="give_an_id" model="ir.ui.view">
<field name="name">give_a_name</field>
<field name="model">your.model</field>
<field name="inherit_id" ref="module.the_id_of_the_view_that_field_is_on" />
<field name="groups_id" eval="[(6, 0, [ref('module.the_id_of_the_group_for_which_you_want_the_field_hidden') ])]" />
<field name="arch" type="xml">
<field name="x_name" position="attributes">
<attribute name="readonly">1</attribute>
</field>
</field>
</record>
So what happens here is that the above view gets activated only when the user belongs in groups_id more here.
You can achieve it by inheriting a view, also you can create a new inherited view from the GUI and add group id for that view.
Enable Debug mode.
Go to Settings > Technical > Views > Create new view
Add All the field like which view you want to inherit, view type
Add Group name inside the Access rights
Inside the architecture add :
<field name="your_field_name" position="attributes">
<attribute name="readonly">1</attribute>
</field>

Hide fields in odoo9 openerp

I want hide fields for user in odoo 9. For example, hide Deadline in Project > Task module.
Only administrator can see this fields.
Any solution how create group etc. hide_only_admin_see and in field add this line.
<field name="date_deadline" groups="hide_only_admin_see" />
I'm find in source groups="base.group_no_one", groups="base.group_user"
but don't understand is it possible create my own group, when add to fiels that only Manager can see this...
Here is my solution:
https://postimg.org/image/rvxi74f51/
https://postimg.org/image/b87h1dlhv/
https://postimg.org/image/5mzst1wtz/
ID from file add to field etc: groups="export.res_groups_84"
On odoo 8, you forbid access to a field to all users (except configuration permissions) in that way:
<field name="date_deadline" position="attributes">
<attribute name="groups">base.group_system</attribute>
</field>
To create new group of permissions,
on odoo 8, you can create record for new category like:
<record model="ir.module.category" id="xxx">
<field name="name">Name of new category of permissions</field>
<field name="sequence">200</field>
</record>
You can create new records for groups permission on res_groups:
<record model="res.groups" id="hide_only_admin_see">
<field name="category_id" ref="XXXX"/>
<field name="name">Usuario</field>
</record>
On category_id you must write the ir_module_category you are creating / overridiing.
After this, you have to create a line on your ir.model.access.csv to give correct permissions to the model you want, something like:
"access_project.issue","project_issue access","model_project_issue","hide_only_admin_see",1,0,0,0
Finally, go to the line and override like:
<field name="date_deadline" groups="your_custom_module.hide_only_admin_see" />

Disable one2many popup odoo 8

Good Day! is it possible to disable pop of tree view in the form. I tried no_open="True" readonly="1" edit="False" both on field and tree view but didn't worked.
<field name="payment_line">
<tree editable="top" create="false">
<field name="product"/>
<field name="description"/>
<field name="account"/>
<field name="unit"/>
<field name="qty"/>
<field name="amount"/>
<field name="total"/>
</tree>
</field>
I've coped with the same issue in odoo 10, my one2many treeview always make a popup on click. No matter editable='bottom' option was set.
Suddenly I've found web_tree_no_open module from codingforfun, that adds a new option:
< tree open="false" >
It's for version 8 but it can be used in 10 just renaming openerp.py to manifest.py
It can be downloaded from here:
https://github.com/initOS/web/tree/8.0-tree-view-no-select/web_tree_no_open
Worked for me, I hope it helps
Use this style to disable click in read as well as edit mode:
<field name="your_o2m" style="pointer-events:none;" />
Use editable='bottom' in this case, like:
<field name='line_ids'>
<tree create='false' editable='bottom'>
<field name='so_line_id' readonly='1'/>
<tree>
</field>
Odoo Version 10.0
web_tree_no_open module adds a new option: <tree open="false">
Lists
The root element of list views is <tree> 3. The list view's root can have the following attributes:
editable
by default, selecting a list view's row opens the corresponding form view. The editable attributes makes the list view itself editable in-place.
Valid values are top and bottom, making new records appear respectively at the top or bottom of the list.
The architecture for the inline form view is derived from the list view. Most attributes valid on a form view's fields and buttons are thus accepted by list views although they may not have any meaning if the list view is non-editable
default_order
overrides the ordering of the view, replacing the model's default order. The value is a comma-separated list of fields, postfixed by desc to sort in reverse order:
<tree default_order="sequence,name desc">
create, edit, delete
allows disabling the corresponding action in the view by setting the corresponding attribute to false
on_write
only makes sense on an editable list. Should be the name of a method on the list's model. The method will be called with the id of a record after having created or edited that record (in database).
The method should return a list of ids of other records to load or update.
string
alternative translatable label for the view
Deprecated since version 8.0: not displayed anymore
Note
if the list view is editable, any field attribute from the form view is also valid and will be used when setting up the inline form
view
in the form and tree view you can add create='false' to disable the create button and edit='false' to disable the edit button.Also use editable="top" or editable="bottom" if you dont want the form view to popup. for example
<tree string="Sale Order" create="false" edit="false" editable="bottom">
...
...
...
</tree>

What is the use of ir.ui.menu in OpenERP 7.0?

I am new to OpenERP and I wish to know about that what is model="ir.ui.menu" in OpenERP. Like this there are many other models also there.
For eg:
model="ir.ui.view"
model="ir.actions.act_window"
Can any one explain all this?
With the ir.ui.menu model you can create new menu items. You can use the menuitem tag, it is shortcut:
<record id="menu_human_readable_name" model="ir.ui.menu" >
<field name="name">Human readable name</field>
<field name="sequence" eval="10" />
<field name="action" ref="action_name" />
<field name="parent_id" ref="base.menu_custom" />
</record>
And you have a small explanation of the ir.actions.act_window model in the Odoo documentation. You can assign the id of this kind of action in the field action of the ir.ui.menu model
The most common action type, used to present visualisations of a model
through views: a window action defines a set of view types (and
possibly specific views) for a model (and possibly specific record of
the model).
<record id="action_human_readable_name_act_window" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Human readable name</field>
<field name="res_model">model.name</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
<field name="target">current</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="search_view_id" ref="ir.ui.view" />
</record>
The ir.ui.view is used for the views where you show the field or tree list
You have more information in the Odoo Documentation:
Views define the way the records of a model are displayed. Each type
of view represents a mode of visualization (a list of records, a graph
of their aggregation, …). Views can either be requested generically
via their type (e.g. a list of partners) or specifically via their id.
For generic requests, the view with the correct type and the lowest
priority will be used (so the lowest-priority view of each type is the
default view for that type).
<record model="ir.ui.view" id="view_id">
<field name="name">view.name</field>
<field name="model">object_name</field>
<field name="priority" eval="16"/>
<field name="arch" type="xml">
<!-- view content: <form>, <tree>, <graph>, ... -->
[...]
<field name="field_name" />
[...]
</field>
</record>
Menus and Actions
Menus are records in the ir.ui.menu table. In order to create a new menu entry, you can directly create a record using the record tag.
<record id="menu_external_id" model="ir.ui.menu">
<field name="name">New Menu</field>
<field name="action" ref="action_external_id"/>
<field name="sequence" eval="<integer value>" />
<field name="parent_id" ref="parent_menu_external_id"/>
</record>
There is a shortcut by using the menuitem tag that you should use preferentially. It offers a flexible way to easily define the menu entry along with icons and other fields.
<menuitem id="menu_external_id"
name="New Menu"
action="action_external_id"
icon="ICON_NAME"
groups="groupname"
sequence="<integer value>"
parent="parent_menu_external_id"
/>
If you remove parent/parent_id from menu/menuitem then it becames top level menu.
Actions
action specifies the identifier of the attached action defined in the action table (ir.actions.act_window). This field is not mandatory : you can define menu elements without associating actions to them.
This is useful when defining custom icons for menu elements that will act as folders. This is how custom icons for “Projects” or “Human Resources” in OpenERP are defined).
The actions define the behavior of the system in response to the actions of the users ; login of a new user, double-click on an invoice, click on the action button, ...
There are different types of simple actions:
Window: Opening of a new window
Report: The printing of a report
- Custom Report: The personalized reports
- RML Report: The XSL:RML reports
Execute: The execution of a method on the server side
Group: Gather some actions in one group
The actions are used for the following events:
User connection.
The user clicks on a menu.
The user clicks on the icon ‘print’ or ‘action’.
<record id="action_external_id" model="ir.actions.act_window">
<field name="name">action.name</field>
<field name="view_id" ref="view_external_id" />
<field name="domain">[('field','operator','value')]</field>
<field name="context">{'key':value}</field>
<field name="res_model">Model Name</field>
<field name="view_type">form|tree</field>
<field name="view_mode">form,tree|tree,form|form|tree</field>
<field name="target">new/current</field>
</record>
I hope you will easily understand my explanation below:
"ir.ui.menu" is a model which is mapped as ir_ui_menu table of database that stores data of menus in Odoo (OpenERP). Every menu in Odoo (OpenERP) is inserted via xml file and stored in database. Also, "ir.ui.view" stores view data (such as form, tree, and search views) and "ir.actions.act_window" stores action data.
Conclusion: Mostly (not all), models inside OpenERP are manifestation of tables inside database.
http://useopenerp.com/v8/model/ir-ui-view#pagetop
https://www.odoo.com/documentation/8.0/reference/actions.html#window-actions-ir-actions-act-window
See the above references for detail.
hope this will help you.