Skip to Content
Menu
This question has been flagged

Hi,

I want change the view of stock_picking_out in my module. I know that I can inherit a view and changed, but the problem is that view has been inherited and changed for another module.

In other words, the module delivery change the view of stock_picking_out with this code:

<record id="view_delivery_order_inherit_stock" model="ir.ui.view">
        <field name="name">stock.picking.out.form</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="stock.view_picking_form"/>
        <field name="arch" type="xml">
            <xpath expr="/form/header//button[@name='action_process']" position="after">
                <button name="%(report_shipping)d" string="Print Delivery Order" states="confirmed,assigned" type="action"/>
                <button name="%(report_shipping)d" string="Print Delivery Order" states="done" type="action" class="oe_highlight"/>
            </xpath>
        </field>
    </record>

I want change this button but I can't called this button in my module that also inherit this view (stock_picking_out).

How I can do that?

Thank You

I'm trying do this:

<record id="view_delivery_order_inherit_stock_inherit" model="ir.ui.view">
        <field name="name">stock.picking.out.form</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="delivery.view_delivery_order_inherit_stock"/>
        <field name="arch" type="xml">

    <xpath expr="//button[@string='Print Delivery Order']" position="replace">
        <button name="%(report_shipping)d" string="Print Delivery Order" states="confirmed,assigned" type="action"/>
        <button name="%(report_shipping)d" string="Print Delivery Order" states="done" type="action" class="oe_highlight"/>
            </xpath>
        </field>
    </record>

but I have this error:

<record id="view_delivery_order_inherit_stock_inherit" model="ir.ui.view">
        <field name="name">stock.picking.out.form</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="delivery.view_delivery_order_inherit_stock"/>
        <field name="arch" type="xml">

    <xpath expr="//button[@string='Print Delivery Order']" position="replace">
        <button name="%(report_shipping)d" string="Print Delivery Order" states="confirmed,assigned" type="action"/>
        <button name="%(report_shipping)d" string="Print Delivery Order" states="done" type="action" class="oe_highlight"/>
            </xpath>
        </field>
    </record>
Traceback (most recent call last):
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 847, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 807, in _tag_record
    f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 154, in _eval_xml
    for n in node]), idref)
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 148, in _process
    idref[id]=self.id_get(cr, id)
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 824, in id_get
    res = self.model_id_get(cr, id_str)
  File "/opt/openerp/trunk/openerp/tools/convert.py", line 833, in model_id_get
    return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
  File "/opt/openerp/trunk/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/trunk/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/trunk/openerp/addons/base/ir/ir_model.py", line 868, in get_object_reference
    data_id = self._get_id(cr, uid, module, xml_id)
  File "/opt/openerp/trunk/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/trunk/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/trunk/openerp/addons/base/ir/ir_model.py", line 861, in _get_id
    raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: teste.report_shipping

Anyone helps me? Thanks

Avatar
Discard
Best Answer

You have to add 'delivery' module as dependency on __openerp__.py

On your inherited .py you can do what you want.

On the XML file do this:

<field name="inherit_id" ref="delivery.view_delivery_order_inherit_stock"/>
Avatar
Discard
Author

Hi, Thank you for your answer. Please see again my question. I'm trying do what you say but I have errors.

Related Posts Replies Views Activity
12
Dec 23
43970
0
Mar 15
4856
1
Mar 15
4739
2
Jul 25
226
0
Apr 25
3584