This question has been flagged
1 Reply
6006 Views

I tried to inherit the treeview of stock.picking, if I try to modify the inherited treeview and make it editable, this change also occurs on the parent treeview. How can I avoid it? Is there any error in my source?

Thanks in advance

This is my code.

wizard.xml

<record id="shipping_carrier.picktree" model="ir.ui.view">
<field name="name">shipping.picking.tree</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="location_dest_id" readonly="1"/>
<field name="partner_id"/>
<field name="date" invisible="1"/>
<field name="min_date"/>
<field name="origin"/>
<field name="group_id" invisible="1"/>
<field name="carrier_id"/>
<field name="backorder_id"/>
<field name="state"/>
<field name="weight"/>
<field name="priority" invisible="1"/>
<field name="picking_type_id" invisible="1"/>
</tree>
</field>
</record>

wizard.py


@api.multi
def shipping(self):
return {
'name' : _('Delivery Check'),
'views' : [(self.env.ref('shipping_carrier.picktree').id, 'tree')],
'view_mode': 'tree',
'type' : 'ir.actions.act_window',
'res_model': 'stock.picking',
'target' : 'new',
'domain' : [('state', '=', 'assigned'), ('min_date', '>=', self.date_start),
('min_date', '<=', self.date_end), ('carrier_id', '=', self.carrier_delivery_id.name)],

}
Avatar
Discard

Inheritance in models and view: https://goo.gl/fGNfBY

hope this helps you.

Best Answer

Give your inherited record a different id :

<record id="<your-custom-name>" model="ir.ui.view">

Also include the following before arch field.

<field name="inherit_id" ref="shipping_carrier.picktree"/>



Avatar
Discard
Author

I used a form with a treeview inside