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
I am working on a new module in Odoo13CE and trying to create a scheduled task with the code:
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<record forcecreate="True" id="electricity_charges_cron" model="ir.cron">
<field name="name">Get electricity charges</field>
<field name="model_id" ref="electricity_charges.model_electricity_charges_readings"/>
<field name="active" eval="True" />
<field name="state">code</field>
<field name="code">model.set_readings()</field>
<field name="interval_number">6</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="active" eval="False" />
<field name="doall" eval="True" />
<field name="user_id" ref="base.user_root" />
</record>
</data>
</odoo>
But when install or update the module this error appears:
odoo.tools.convert.ParseError: "null value in column "activity_user_type" violates not-null constraint
Any idea how I can resolve this error? Have the mail module installed.
I have created a few companies under res.company
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="True">
<record id="partner_my_company_hk" model="res.partner" context="{'default_is_company': True}">
<field name="name">My company HK</field>
<field name="company_id" eval="None"/>
<field name="customer" eval="False"/>
<field name="is_company" eval="True"/>
<field name="street"></field>
<field name="city"></field>
<field name="zip"></field>
<field name="phone"></field>
<field name="email">info#my_company.com</field>
<field name="website">www.my_company.com</field>
<field name="image" type="base64" file="base/static/img/res_company_logo.png"/>
</record>
<record id="partner_my_company_us" model="res.partner">
<field name="name">My company US</field>
<field name="company_id" eval="None"/>
<field name="customer" eval="False"/>
<field name="is_company" eval="True"/>
<field name="street"></field>
<field name="city"></field>
<field name="zip"></field>
<field name="phone"></field>
<field name="email">info#my_company.com</field>
<field name="website">www.my_company.com</field>
<field name="image" type="base64" file="base/static/img/res_company_logo.png"/>
</record>
<record id="company_my_company_hk" model="res.company">
<field name="name">My company HK</field>
<field name="partner_id" ref="partner_my_company_hk"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record id="partner_my_company_hk" model="res.partner">
<field name="company_id" ref="company_my_company_hk"/>
</record>
<record id="company_my_company_us" model="res.company">
<field name="name">My company US</field>
<field name="partner_id" ref="partner_my_company_us"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record id="partner_my_company_us" model="res.partner">
<field name="company_id" ref="company_my_company_us"/>
</record>
</data>
</odoo>
This is my original res_users.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="base.user_admin" model="res.users">
<field name="groups_id" eval="[(4, ref('account.group_account_user'))]"/>
</record>
</data>
</odoo>
So I want to set those 2 newly created 2 companies into base.user_admin
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="base.user_admin" model="res.users">
<field name="groups_id" eval="[(4, ref('account.group_account_user'))]"/>
<field name="company_id" ref="company_my_company_hk" />
<field name="company_ids" eval="[(4, ref('company_my_company_hk')),(4, ref('company_my_company_us'))]" />
</record>
</data>
</odoo>
And it is not working. But when I uninstall the module and reinstall it works.
Why? I cannot uninstall the module just to make it work in the future. What are the limitations and how to bypass the limits?
You can change the noupdate value on XML, change the desired fields and should take the change on noupdate back.
<!-- Allow updating on noupdate=True records -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'base'), ('name', '=', 'user_admin')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="base.user_admin" model="res.users">
<!-- change fields here -->
</record>
<!-- Revoke noupdate change -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'base'), ('name', '=', 'user_admin')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
External ID user_admin in base has been marked as noupdate.
And noupdate cannot be overridden.
Unless I run
UPDATE ir_model_data SET noupdate=False WHERE name = 'user_admin' and module='base';
Otherwise I won't be able to update it when I upgrade the module
More refined solution to #CZoellner 's solution is:
<function name="toggle_noupdate" model="ir.model.data" eval="['res.users', ref('base.user_admin')]"/>
How can I close the odoo session after printing a qweb report?
What I want is to close session after clicking Sample Report
<?xml version="1.0"?>
<odoo>
<record id="paperformat_euro_landscape"
model="report.paperformat">
<field name="name">European A4 Landscape</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">Landscape</field>
<field name="margin_top">35</field>
<field name="margin_bottom">15</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">35</field>
<field name="dpi">90</field>
</record>
<report id="action_mantto_task_report"
string="Sample Report"
model="rep.oper"
report_type="qweb-pdf"
name="repop_report.report_repop_task_template"
paperformat="paperformat_euro_landscape"
/>
</template>
</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.