Odoo 10 - ParseError: - odoo

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..." />

Related

inheriting the inherit view in xml

In 'product.template' I need to add two fields for that I written one view in xml file but the problem is 'inherit_id' of 'accounts' is inheriting from 'product.product_template_form_view'.so how should I use inherit_id in my file.
I tried with below code but it was showing error please help me
account.product_view.xml code:
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="priority">5</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page string="Sales" position="after">
<page string="Accounting" groups="account.group_account_invoice">
<group>
<label for="categ_id" string="Internal Category"/>
<div><field name="categ_id" colspan="3" nolabel="1"/></div>
</group>
<group name="properties">
<group>
<field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"/>
<field name="taxes_id" colspan="2" widget="many2many_tags" required="1"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"/>
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags" required="1"/>
</group>
</group>
</page>
</page>
</field>
</record>
mycode:
<record model="ir.ui.view" id="gst_account_view_inherit">
<field name="name">gst_account_view_add_form_inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="account.product_template_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field/page/page/group/group/field[#name='taxes_id']" position="after">
<field name="cgst_id"/>
</xpath>
</data>
</field>
</record>
I need to add my 'cgst_id' field under 'taxes_id' field.
You don't need to give full path.
Try with these code:
<field name="taxes_id" position="after">
<field name="cgst_id"/>
</field>

Odoo : make form fields show/hide based on dropdown

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

Group by field name

I want to do Group by by City but this possibility doesn't shows up. where is my mistake? there is field city in python file and it's showing up in tree view but not really in Group by
<openerp>
<data>
<record id="vpicktree" model="ir.ui.view">
<field name="name">Picking tree city</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree"/>
<field name="arch" type="xml">
<field name="location_dest_id" position="after">
<field name="city"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="stock_picking_filter_city_search">
<field name="name">stock.picking.tree.filter_search</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<search string="City">
<filter name="city" string="City" context="{'group_by':'city'}"/>
</search>
</field>
</record>
<record id="action_picking_tree_city" model="ir.actions.act_window">
<field name="name">City</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,calendar</field>
<field name="domain"></field>
<field name="context">{ 'group_by':'city' }</field>
<field name="search_view_id" ref="stock.view_picking_internal_search"/>
</record>
</data>
</openerp>
The group by must be in search view not on the action setion as you did, so you have to edit your search view:
<record model="ir.ui.view" id="stock_picking_filter_city_search">
<field name="name">stock.picking.tree.filter_search</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<search string="City">
<filter name="city" string="City" context="{'group_by':'city'}"/>
<group expand="0" string="Grouper par">
<filter string="City" icon="terp-personal" domain="[]" context="{'group_by':'city'}"/>
</group>
</search>
</field>
</record>

How to change default form of many2one field in odoo

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

OpenERP 7: Set Default Value of Group By

I'm grouping POLine by Order Reference by Manual , it filtering the data as shown in below image.
<record id="view_purchase_line_search" model="ir.ui.view">
<field name="name">purchase.order.line.search</field>
<field name="model">purchase.order.line</field>
<field name="arch" type="xml">
<search string="Search Purchase Order">
<field name="order_id"/>
<field name="partner_id" string="Supplier" filter_domain="[('partner_id', 'child_of', self)]"/>
<group expand="1" string="Group By...">
<filter icon="terp-gtk-jump-to-rtl" string="Order Reference" domain="[]" context="{'group_by' :'order_id'}"/>
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />
</group>
</search>
</field>
</record>
<record id="view_purchase_line_list" model="ir.ui.view">
<field name="name">purchase.order.line.tree</field>
<field name="model">purchase.order.line</field>
<field name="arch" type="xml">
<tree string="Purchase Order Lines" create="false">
<field name="order_id"/>
<field name="partner_id" string="Supplier" />
<field name="product_id"/>
<field name="price_unit"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="price_subtotal"/>
<field name="date_planned" widget="date" width="135"/>
<field name="state" invisible="1"/>
<field name="invoiced" invisible="1"/>
</tree>
</field>
</record>
<record id="action_purchase_line_list" model="ir.actions.act_window">
<field name="name">PO Tree Structure</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order.line</field>
<field name="view_id" ref="view_purchase_line_list"/>
<field name="context">{'search_default_order_id':1 }</field>
<field name="search_view_id" ref="view_purchase_line_search"/>
</record>
<menuitem action="action_purchase_line_list" id="menu_purchase_list"
parent="menu_procurement_management"
sequence="0"/>
But i need this filter by default (i.e) when openning this window at first time it should groupped the data
Tried Below Code:
<field name="context">{'search_default_order_id':1 }</field>
I need "Order Reference" instead of Order Reference POOOO1 in search field.
Any Advice will be helpful.
update your code with this.
<filter name="groupby_order" icon="terp-gtk-jump-to-rtl" string="Order Reference"
domain="[]" context="{'group_by' :'order_id'}"/>
and pass <field name="context">{'search_default_groupby_order': 1}</field> in
act_window. Hope this will be useful to you.
try this, In your purchase_view.xml file search this id view_purchase_order_filter and than add below filter in Group By...
<filter icon="terp-gtk-jump-to-rtl" name="order_id" string="Order Reference" domain="[]" context="{'group_by' :'name'}"/>
Than find this id purchase_form_action and paste below context
<field name="context">{'search_default_order_id': 1}</field>
Hope this will help you.