Odoo/openerp 8 supports creating dashboard in which we can add multiple reports into it.
My question is: How can we inherit this dashboard to customize it?
For example, I want to add a button which helps clone the dashboard to another user.
It seems that this dashboard is not a usual FormView.
You can't inherit dashboards in Odoo 8.because dashboards is work like views container not usual view if you want to customize one .. just copy it's code and paste it in your module over again and customize what you need.
Try to make formview for yourself :-)
This is a good example:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.actions.act_window" id="act_centiro_stocks_tree_pendientes">
<field name="name">Centiro stock</field>
<field name="res_model">stock.picking</field>
<field name="view_type">tree</field> <!-- form -->
<field name="view_mode">tree</field>
<field name="domain">[('state', 'not in', ('assigned','done'))]</field>
</record>
<record model="ir.actions.act_window" id="act_centiro_stocks_tree_procesados">
<field name="name">Centiro stock</field>
<field name="res_model">stock.picking</field>
<field name="view_type">tree</field> <!-- form -->
<field name="view_mode">tree</field>
<field name="domain">[('state', 'in', ('assigned','done'))]</field>
</record>
<record model="ir.actions.act_window" id="act_centiro_stocks_graph">
<field name="name">Operaciones Centiro</field>
<field name="res_model">gc.operaciones.centiro</field>
<field name="view_type">form</field>
<field name="auto_refresh" eval="1" />
<field name="view_mode">kanban,form</field>
</record>
<record model="ir.ui.view" id="board_view_stock_centiro_form">
<field name="name">Stock Centiro</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Centiro Stock Dashboard">
<hpaned>
<child1>
<action string="Estado almacén Centiro" name="%(act_centiro_stocks_graph)d" colspan="2" />
</child1>
<child2>
<action string="Pedidos pendientes" name="%(act_centiro_stocks_tree_pendientes)d" colspan="2" />
<action string="Pedidos sin ubicar" name="%(act_centiro_stocks_tree_procesados)d" colspan="2" />
</child2>
</hpaned>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_stock_centiro_board">
<field name="name">Stock Centiro Dashboard</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="usage">menu</field>
<field name="view_id" ref="board_view_stock_centiro_form" />
</record>
<menuitem id="dashboard_menu" name="Dasboard custom module"
parent="cabecera_dashboard_custom_module" action="open_stock_centiro_board" />
</data>
Good luck
Related
Odoo 10 -
I am trying to create an attendance module for partners rather than employees. I am copying code from the Attendance Module included in Odoo but am stuck and getting ParseError. The problem seems to be the action="base.res_partner_kanban_view"/>
The error is below
ParseError: "ir.actions.view" while parsing
/opt/odoo/odoo10/odoo-10.0/customaddons/gym_attendance/views/gym_attendance_view.xml:93,
near
<menuitem id="menu_gym_attendance_view_members_kanban" name="Members" parent="menu_gym_attendance_manage_attendances" sequence="15" action="base.res_partner_kanban_view
Below is my XML
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- views -->
<record id="view_attendance_tree" model="ir.ui.view">
<field name="name">gym.attendance.tree</field>
<field name="model">gym.attendance</field>
<field name="arch" type="xml">
<tree string="Member attendances">
<field name="partner_id"/>
<field name="check_in"/>
<field name="check_out"/>
</tree>
</field>
</record>
<record id="gym_attendance_view_form" model="ir.ui.view">
<field name="name">gym.attendance.form</field>
<field name="model">gym.attendance</field>
<field name="arch" type="xml">
<form string="Member attendances">
<sheet>
<group>
<field name="partner_id"/>
<field name="check_in"/>
<field name="check_out"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="gym_attendance_view_filter" model="ir.ui.view">
<field name="name">gym_attendance_view_filter</field>
<field name="model">gym.attendance</field>
<field name="arch" type="xml">
<search string="Gym Attendance Search">
<field name="partner_id"/>
<!-- <field name="department_id"/> -->
<filter name="today" string="Today" domain="[('check_in', '>=', datetime.datetime.now().replace(hour=0, minute=0, second=0)),('check_in', '<=', datetime.datetime.now().replace(hour=23, minute=59, second=59))]" />
<filter string="Current Month" domain="[('check_in', '>=', datetime.datetime.now().strftime('%Y-%m-01'))]" />
<separator/>
<filter string="No Check Out" domain="[('check_out', '=', False)]" />
<separator/>
<filter string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" />
<group expand="0" string="Group By">
<filter name="member" string="Member" context="{'group_by':'partner_id'}"/>
<separator/>
<filter name="groupby_name" string="Month" context="{'group_by':'check_in'}"/>
</group>
</search>
</field>
</record>
<record id="gym_attendance_action_my_attendances" model="ir.actions.client">
<field name="name">Attendance</field>
<field name="tag">gym_attendance_my_attendances</field>
<field name="target">main</field>
</record>
<!-- actions -->
<record id="gym_attendance_action" model="ir.actions.act_window">
<field name="name">Attendances</field>
<field name="res_model">gym.attendance</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{"search_default_today":1}</field>
<field name="search_view_id" ref="gym_attendance_view_filter" />
<field name="help" type="html">
<p>The attendance records of your members will be displayed here.</p>
<p>Please make sure you're using the correct filter if you expected to see any.</p>
</field>
</record>
<record id="gym_attendance_action_my_attendances" model="ir.actions.client">
<field name="name">Gym Attendance</field>
<field name="tag">gym_attendance_my_attendances</field>
<field name="target">main</field>
</record>
<menuitem id="menu_gym_attendance_root" name="Attendances" sequence="90" web_icon="gym_attendance,static/description/icon.png"/>
<menuitem id="menu_gym_attendance_my_attendances" name="Gym Attendances" parent="menu_gym_attendance_root" sequence="10" action="gym_attendance_action_my_attendances"/>
<menuitem id="menu_gym_attendance_manage_attendances" name="Manage Attendances" parent="menu_gym_attendance_root" sequence="20"/>
<menuitem id="menu_gym_attendance_view_attendances" name="Attendances" parent="menu_gym_attendance_manage_attendances" sequence="10" action="gym_attendance_action"/>
<menuitem id="menu_gym_attendance_view_members_kanban" name="Members" parent="menu_gym_attendance_manage_attendances" sequence="15" action="base.res_partner_kanban_view"/>
</odoo>
I think you trying to call id of kanban view of res.partner instead of the id of action. Either you have to find out the correct id for the action or create a new one and use.
Here is the example id for Customer base.action_partner_form which available in base/res/res_partner.xml
I hope it will help you.
Try with : gym_attendance_action,
you need to specify the action to your menu-item and this action will call your view.
Your action:
<field name="search_view_id" ref="gym_attendance_view_filter" />
Your menu-item:
<menuitem id="id_menu_item" name="NameOfYourView" parent="model.model"
action="turnover_filtered_view_action..." />
My custom module view looks like this
<odoo>
<data>
<record model="ir.ui.view" id="session_form_view">
<field name="name">item.form</field>
<field name="model">inventory.item</field>
<field name="arch" type="xml">
<form string="Items Form">
<sheet>
<group>
<field name="name"/>
<field name="code"/>
<field name="department"/>
<field name="state"/>
</group>
<group>
<field name="measurement" position="attributes">
<attribute name="attrs">{'invisible': [('state', '=', True)]}</attribute>
</field>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="items_tree">
<field name="name">Item</field>
<field name="res_model">inventory.item</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<!-- <field name="context" eval="{'state':True}" /> -->
</record>
<menuitem id="main_openacademy_menu" name="Inventory"></menuitem>
<menuitem id="openacademy_menu" name="Store" parent="main_openacademy_menu"></menuitem>
<menuitem id="store_items_menu" name="Store items" parent="openacademy_menu" action="items_tree"/>
</data>
</odoo>
I have a simple model
I want to hide/show based on the department drop down. But some how for a lot of cases attrs is not working. I am begginer and using odoo 10.
Thanks
Hi I have a mode Unit which inherits product.product.
I have defined the custom views for Unit and they work fine from the menu.
Property which inherits account.asset.assets has multiple units.
How do I call my custom unit views from the Property view?
When I click on Add an item I get the standard product form.
<record id="unit_form" model="ir.ui.view">
<field name="name">All Units</field>
<field name="model">product.product</field>
<field name="sequence">0</field>
<field name="arch" type="xml">
<form string="Unit">
<group>
<field name="property_id" widget="many2one" attrs="{'required': [('is_unit', '=', True)]}" />
<field name="is_unit" invisible="1" />
<field name="features_amenities_ids" placeholder="Features and Amenities" widget="many2many_tags" />
<field name="appliences_ids" placeholder="Apliences" widget="many2many_tags" />
<field name="lst_price" string="Rent" />
</group>
</form>
</field>
</record>
<record id="unit_tree" model="ir.ui.view">
<field name="name">All Units</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<tree string="Units" default_order='property_id,name'>
<field name="property_id" />
<field name="name" string="Unit#" />
</tree>
</field>
</record>
<record id="action_unit" model="ir.actions.act_window">
<field name="name">Units</field>
<field name="res_model">product.product</field>
<field name="view_mode">search, kanban,tree,form</field>
<field name="domain">[('is_unit', '=', True)]</field>
<field name="context">{'default_is_unit':1 }</field>
<field name="search_view_id" ref="unit_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a Unit.
</p>
<p>
Here you will find the all units.
</p>
</field>
</record>
<record id="action_unit_form" model="ir.actions.act_window.view">
<field name="act_window_id" ref="action_unit" />
<field name="view_id" ref="unit_form" />
<field name="view_mode">form</field>
<field name="sequence">10</field>
</record>
<record id="action_unit_tree" model="ir.actions.act_window.view">
<field name="act_window_id" ref="action_unit" />
<field name="view_id" ref="unit_tree" />
<field name="view_mode">tree</field>
<field name="sequence">9</field>
</record>
<record id="action_unit_kanban" model="ir.actions.act_window.view">
<field name="act_window_id" ref="action_unit" />
<field name="view_id" ref="product.product_kanban_view" />
<field name="view_mode">kanban</field>
<field name="sequence">8</field>
</record>
<menuitem action="action_unit" sequence="2"
id="menu_units_list" name="Units" parent="menu_property_sub"/>
This is from Property
<notebook colspan="4">
<page string="Units">
<field name="unit_ids" nolabel="1" widget="one2many" >
<tree string="Units">
<field name="name" string="Unit#"/>
</tree>
</field>
</page>
</notebook>
If you want to specify a view for many2one or one2many field:
<field name="m2o_id" context="{'form_view_ref': 'module_name.form_id'}"/>
hope this helps. there are other key word like tree_view_ref for tree views
I had successfully inherited the CRM module into my custom module.I'm able to view the Form view but i need to show Tree view first.When i click Lead button in the main menu i'm able to show the form view (like in img1), but i need to show the tree view(like in img 2)
img 1
img 2
lead_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_lead_tree" model="ir.ui.view">
<field name="name">bala.lead</field>
<field name="model">bala.lead</field>
<field name="arch" type="xml">
<tree string="Leads">
<field name="contact_name"/>
<field name="lead_source"/>
<field name="lead_status"/>
</tree>
</field>
</record>
<!-- ========================This is Form layout===============================-->
<record id="crm_case_form_view_leads_extended" model="ir.ui.view">
<field name="name">CRM - Leads Form</field>
<field name="model">bala.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
<field name="arch" type="xml">
<field name="email_from" postion="replace"/>
<field name="contact_name" position="replace"/>
<label for="contact_name" position="replace">
<br/>
</label>
<xpath expr="//label[#for='street']" position="before">
<field name="contact_name"/>
</xpath>
<xpath expr="//label[#for='section_id']" position="before">
<field name="lead_source"/>
<field name="lead_status"/>
</xpath>
<field name="function" position="replace"/>
<field name="partner_name" position="replace"/>
<field name="priority" position="replace"/>
<field name="categ_ids" position="replace"/>
<field name="partner_id" position="replace"/>
</field>
</record>
<!-- ===========================Action layout=========================== -->
<record id="new_lead" model="ir.actions.act_window">
<field name="name">Leads</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">bala.lead</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_lead_tree"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name ="Lead" id = "menu_lis_lab" />
<menuitem name="Leads" id="sub_lead" parent="menu_lis_lab" />
<menuitem name="Create Lead" id="create_lead" parent="sub_lead" action="new_lead"/>
</data>
</openerp>
then on click of any lead i'm getting img 3 (invalid view)and on click on Create button img 4 is being displyed , but i need to get img1
img 3
img 4
Add tree view to your xml file, and you can add more fields in this according to requirement,
<record id="view_lead_tree" model="ir.ui.view">
<field name="name">bala.lead</field>
<field name="model">bala.lead</field>
<field name="arch" type="xml">
<tree string="Leads">
<field name="contact_name"/>
<field name="lead_source"/>
<field name="lead_status"/>
</tree>
</field>
</record>
update your act_window
<record id="new_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">bala.lead</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_lead_tree"/>
</record>
Hope this will help you.
In OpenERP version 6, in my custom module, I changed the Timesheet form view by inheriting as my custom view below:
<record id="oit_hr_timesheet_sheet_form" model="ir.ui.view">
<field name="name">oit.hr.timesheet.sheet.form</field>
<field name="model">hr_timesheet_sheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<data>
<button name="sign_in" position="replace"/>
<button name="sign_out" position="replace"/>
<field name="state_attendance" position="after">
<field name="day_attendance"/>
</field>
<field name="total_attendance_day" position="replace"/>
<field name="total_difference_day" position="replace"/>
<field name="total_timesheet_day" position="replace"/>
<field name="timesheet_ids" position="after">
<field name="day_difference"/>
<field name="day_timesheet"/>
</field>
<page string="By Day" position="replace" />
<notebook position="inside">
<page string="Time balance">
<group colspan="4" col="2" width="600">
<field name="time_account_balance"/>
<field name="working_hour"/>
<field name="attendance_hour"/>
<separator string="Timesheet numbers until the viewed working period." colspan="4" />
<field name="total_time_account_balance"/>
<field name="total_working_hour"/>
<field name="total_attendance_hour"/>
</group>
</page>
</notebook>
</data>
</field>
</record>
Then the Human Resources / Time Tracking / My Timesheet form totaly crash. But when I go to Administration / Customization / User Interface / Menu Items, and I choose "My Timesheet" menu item to fix its action from "ir.actions.server" to "ir.actions.act_window" and select object "hr_timesheet_sheet.sheet", then choose my view "oit.hr.timesheet.sheet.form" for object's form view, choose my view "oit.hr.timesheet.sheet.tree.simplified" for object's tree view.
Then I have "My Timesheet" form shown correctly.
Why is that? I think there is somethings in my view code not work with "My Timesheet" menu and "ir.actions.server" defined in file hr_timesheet_sheet/hr_timesheet_sheet_data.xml, Here I paste the openerp6 code in hr_timesheet_sheet_data.xml:
<record id="ir_actions_server_timsheet_sheet" model="ir.actions.server">
<field eval="5" name="sequence"/>
<field eval=""""code"""" name="state"/>
<field eval=""""ir.actions.server"""" name="type"/>
<field name="model_id" ref="model_hr_timesheet_current_open"/>
<field eval="[(6,0,[])]" name="child_ids"/>
<field eval=""""action = self.pool.get('hr.timesheet.current.open').open_timesheet(cr, uid, object.id, context)"""" name="code"/>
<field eval=""""True"""" name="condition"/>
<field eval=""""My Timesheet"""" name="name"/>
</record>
<record id="menu_act_hr_timesheet_sheet_form_my_current" model="ir.ui.menu">
<field name="name">My Timesheet</field>
<field eval="1" name="sequence"/>
<field name="parent_id" ref="hr_attendance.menu_hr_time_tracking"/>
<field name="icon">STOCK_JUSTIFY_FILL</field>
<field name="action" ref="ir_actions_server_timsheet_sheet"/>
</record>
Kindly please help me to have correct view code or a solution so that I will not need to change information for menu "My Timesheet" after I upgrade my custom module! thanks a lot!