Hello!
I'm using Odoo12 and for the first time i made a custom module.
I added new fields to a view (stock.picking) without issues, now i want to have the value of my fields when i print related report (stock.report_deliveryslip).
I tried several times without success. Can someone help me?
My module has:
models.py
views.xml
stock_report_deliveryslip_inherit.xml
I think my problem is in stock_report_delivery_inherit, i can print some text but i can't do it for the value of my custom field.
Thanks for your attention!
1. models.py
from odoo import models, fields, api class StockPickingInherit(models.Model): _inherit = 'stock.picking' a_field = fields.Char(string='a text', store=True) b_field = fields.Char(string='b text', store=True) c_field = fields.Char(string='c text', store=True)
views.xml
<odoo>
<data> <record id="stok_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"> <xpath expr="//field[@name='carrier_id']" position="after"> <field name='a_field'/> </xpath> <xpath expr="//field[@name='carrier_id']" position="after"> <field name='b_field'/> </xpath> <xpath expr="//field[@name='carrier_id']" position="after"> <field name='c_field'/> </xpath> </field> </record>
</data> </odoo>
stock_report_delivery_inherit.xml
<odoo> <template id="stock_report_delivery_inherit" inherit_id="stock.report_delivery_document"> <xpath expr="//table[@class='table table-sm']" position="after"> <div class="row mt32 m32" id="test_inherit"> <div class="col-auto mw-100 mb-2">
<h3>INFO: </h3>
<strong>One: </strong> <!-- "a_field" value-->
<strong>Two </strong> <!-- "b_field" value--> <strong>Three: </strong><!-- "c_field" value-->
</div> </div> </xpath> </template> </odoo>