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.

1

inherit fields and view from stock.picking (v7)

By
Laurent33
on 5/2/13, 11:45 AM 3,006 views

Hi,

in a customer module, I add a new field in stock.picking class to calculate total weight with the _inherit keyword. So, it works good for delivery orders (class stock.picking.out inherit stock.picking) and also for incoming shipments (class stock.picking.in inherit stock.picking).

Then, I want to display this field on delivery orders view (stock.view_picking_out_form) and on incoming shipment view (stock.view_picking_in_form). This 2 views are defined in stock module with inherit from view_picking_form.

If I inherit stock.view_picking_form in my customer xml like that :

        <record model="ir.ui.view" id="view_picking_form" >
        <field name="name">stock.picking.form</field>
        <field name="model">stock.picking</field>
        <field name="priority" eval="10"/>
        <field name="inherit_id" ref="stock.view_picking_form" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='stock_journal_id']" position="after" version="7.0">
                <field name="picking_weight" />
            </xpath>
        </field>
    </record>

the field does not appear on the screen of delivery orders or incoming shipment...

If I inherit stock.view_picking_out_form like that:

        <record model="ir.ui.view" id="view_picking_out_form_1" >
        <field name="name">stock.picking.out.form1</field>
        <field name="model">stock.picking.out</field>
        <field name="inherit_id" ref="stock.view_picking_out_form" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='stock_journal_id']" position="after" version="7.0">
                <field name="picking_weight" />
            </xpath>
        </field>
    </record>

after updating my module, I can't load the view when clicking on delivery orders...

my eclipse log write :

2013-05-02 13:39:52,480 5920 ERROR semens openerp.osv.osv: Uncaught exception

Traceback (most recent call last): File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\addons\stock\stock.py", line 728, in fields_view_get return super(stock_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\orm.py", line 2260, in fields_view_get xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\orm.py", line 1932, in __view_look_dom_arch model = res[0][1] IndexError: list index out of range 2013-05-02 13:39:52,494 5920 ERROR semens openerp.netsvc: list index out of range Traceback (most recent call last): File "C:\Users\IOTA\workspace\OpenERP7def\openerp\netsvc.py", line 293, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\service\web_services.py", line 626, in dispatch res = fn(db, uid, params) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\addons\stock\stock.py", line 728, in fields_view_get return super(stock_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\orm.py", line 2260, in fields_view_get xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx) File "C:\Users\IOTA\workspace\OpenERP7def\openerp\osv\orm.py", line 1932, in __view_look_dom_arch model = res[0][1] IndexError: list index out of range

c:\users\iota\workspace\openerp7def\openerp\osv\orm.py(1932)__view_look_dom_arch() -> model = res[0][1] (Pdb)

It seems that picking_weight field doesn't exist in stock.picking.out class...

How can I do ?

Maybe put it in stock.picking and stock.picking.out and in.

Josse Colpaert (jco)
on 5/2/13, 7:12 PM

how works heritage if we must redefine the field in different heritages

Laurent33
on 5/3/13, 11:11 AM
0

patrick

--patrick--
1958
| 5 4 7
Baarn, Netherlands
--patrick--
patrick
On 5/2/13, 8:12 PM

The error message talks about an 'IndexError: list index out of range' in the method/assignment: '__view_look_dom_arch model = res[0][1]'

So somehow res[0][1] is referring to a non-existing thing.

  • If this value is in an existing module, you might not have given some information needed for the method to finish correctly
  • If this value is in your own module, something from the super might not have been send in order to finish correctly.

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: 5/2/13, 11:45 AM
Seen: 3006 times
Last updated: 3/16/15, 8:10 AM