Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to change a view that has been inherited from another module?

By
Luís
on 10/11/13, 5:04 PM 4,577 views

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

0

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 10/11/13, 6:37 PM

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"/>

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

Luís
on 10/12/13, 11:34 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 10/11/13, 5:04 PM
Seen: 4577 times
Last updated: 3/16/15, 8:10 AM