Odoo Breadcrumb on form view - odoo

I have a form view and the breadcrumb is reading False. i am not sure where to set this but I would like the Partners name instead of False.
Below is my form view
<record id="view_ds_repair_form" model="ir.ui.view">
<field name="name">ds.repair.form</field>
<field name="model">ds.repair</field>
<field name="arch" type="xml">
<form string="Repairs">
<sheet>
<label for="name" class="oe_edit_only"/>
<group>
<group>
<field name="x_partner_id" placeholder="Customer Name"/>
<field name="computer_make"/>
<field name="password" />
<field name="items" widget="many2many_tags"/>
</group>
<group>
<field name="create_date"/>
<field name="status" />
<field name="priority"/>
<field name="estimatedrepair_cost"/>
</group>
</group>

It seems name field or rec_name field value is empty. So you have to provide value of it. Afterwards, it will display correct information.

Related

Format to xml view in odoo

I would like to give this structure to new fields that I add to this (inherited) view.
This is the xml code that I am using:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="fleet_vehicule_l10n_new_form"
model="ir.ui.view">
<field name="name">fleet.vehicle.l10n.new.form</field>
<field name="model">fleet.vehicle</field>
<field name="inherit_id"
ref="fleet.fleet_vehicle_view_form" />
<field name="arch"
type="xml">
<field name="model_id"
position="after">
<group >
<field name="vehiculo_sat" />
</group>
</field>
<field name="description"
position="after">
<group string="MX EDI group">
<field name="transport_permit_no" />
<field name="transport_insurer" />
<field name="transport_insurance_policy" />
<field name="transport_perm_sct" />
<field name="vehicle_model" />
<field name="vehicle_config" />
<field name="vehicle_licence" />
<field name="trailer_ids" />
<field name="figure_ids" />
</group>
</field>
</field>
</record>
</data>
</odoo>
How can I achieve this? I understand that odoo uses bootstrap, but I don't know how to apply the classes in the xml of an inherited view.
Edit
I try this, but still not working:
<field name="description" position="after">
<!-- <field name="vehicle_licence" />
<field name="vehicle_model" /> -->
<group>
<field name="transport_permit_no" />
<field name="transport_insurer" />
<field name="transport_insurance_policy" />
<field name="transport_perm_sct" />
</group>
<field name="vehicle_config" />
<group>
<field name="trailer_ids" />
</group>
<group>
<field name="figure_ids" />
</group>
</field>
What am I doing wrong?
The description filed is inside a group, so adding two groups inside a group won't work like in the picture above.
You can add the group to sheet like following:
<xpath expr="//sheet" position="inside">
<group>
<group string="MX EDI group">
<field name="transport_permit_no"/>
<field name="transport_insurer"/>
<field name="transport_insurance_policy"/>
<field name="transport_perm_sct"/>
<field name="vehicle_model"/>
<field name="vehicle_config"/>
<field name="vehicle_licence"/>
</group>
<group string="Second Group">
</group>
</group>
<group>
<field name="trailer_ids"/>
<field name="figure_ids"/>
</group>
</xpath>
The default fleet vehicle form added six groups inside a group, so you can append the two groups inside that group
Example:
<xpath expr="//sheet/group" position="inside">
<group string="MX EDI group">
<field name="transport_permit_no"/>
<field name="transport_insurer"/>
<field name="transport_insurance_policy"/>
<field name="transport_perm_sct"/>
<field name="vehicle_model"/>
<field name="vehicle_config"/>
<field name="vehicle_licence"/>
</group>
<group string="Second Group">
</group>
</xpath>
<xpath expr="//sheet/group" position="after">
<group>
<field name="trailer_ids"/>
<field name="figure_ids"/>
</group>
</xpath>
The default col attribute value for group is 2

Odoo 13 error in xml file while upgrading the module

I am getting this error while upgrading my custom module in odoo13 while upgrading it , the error is within this xml file.
File "/odoo/odoo-server/addons/gunalan_demo/views/views.xml", line 31
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: form line 9 and field, line 31, column 16
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id ="request_form" model ="ir.ui.view">
<field name="name">view.demo.form</field>
<field name="model">car.request</field>
<field name="arch" type="xml">
<form string ="Car Request Form">
<sheet>
<div class="oe_title">
<label for="name" class="oe_title_only"/>
<h1>
<field name="name" placeholder="Request Demo"/>
</h1>
</div>
<group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="emplyoee_id"/>
<field name="car_id"/>
</group>
</group>
</sheet>
</field>
</record>
<record id='request_tree' model='ir.ui.view' >
<field name='name'>view.demo.tree</field>
<field name='model'>car.request</field>
<field name='arch' type='xml'>
<tree string='Car Request Tree'>
<field name="name"/>
<field name="emplyoee_id"/>
<field name="car_id"/>
<field name="date_from"/>
<field name="date_to"/>
</tree>
</field>
</record>
<record id="action_request_views" model="ir.actions.act_window">
<field name="name">Car Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">car.request</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Car Request
</p><p>
Click here to add
</p>
</field>
</record>
<!-- This Menu Item will appear in the Upper bar, That's why It needs NO parent or action -->
<menuitem id="menu_car_request_root" name="Car Request" sequence="10"/>
<menuitem id="menu_car_request_categ" name="Car Request" parent="menu_car_request_root" sequence="1"/>
<menuitem id="menu_car_request" name="Car Request" parent="menu_car_request_categ" action="action_request_views" sequence="1"/>
</data>
</odoo>
You know the error message is already telling you everything? You've opened the form tag but never closed it.

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

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 version 6, My Timesheet form crashed after inherited

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!