An Easy Way to Modify Existing View

Odoo report and form modification

Modify Form

class StockPickingInherit(models.Model):
_inherit = 'stock.picking'

send_by = fields.Char(
string="Dikirim Oleh"
)
<record id="stock_picking_inherit" model="ir.ui.view">
<field name="name">stock.picking.inherit</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<field name="owner_id" position="after">
<field name="send_by"/>
</field>
</field>
</record>

Note:

Modify Report

<template id="report_label_inherit" inherit_id="product.report_simple_label">
<xpath expr="//td[@class='text-center align-middle']" position="replace">
<td class="text-center align-middle" id="test_inherit">
<t>
<center>
<img alt="Barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', 'ABCD', 600, 150)"/>
<span>ABCD</span>
</center>
</t>
</td>
</xpath>
</template>

Note:

Odoo Consultant. Reach me on linkedin.com/in/amirulm