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

Wizard view/model inheritance.

By
Alexander
on 6/3/13, 7:38 AM 2,295 views

I need to add EAN field on "Recieve product" form. image description

I'm trying to inherit stock_partial_picking_line class, with using my extra module.

Model:

from openerp.osv import fields, osv
class stock_partial_picking_line(osv.TransientModel):
_name = "stock.partial.picking.line"
_rec_name = "product_id"
_inherit = "stock.partial.picking.line"

_columns = {
    'product_id_ean13': fields.related('product_id', 'ean13', type='char', string='EAN'),
}

View:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- this view of stock.partial.picking wizard is dedicated to internal picking. The fields_view_get is ovveridden in order to change the label of the process button and the separator. -->
        <record id="stock_partial_picking_form" model="ir.ui.view">
            <field name="name">stock.partial.picking.form</field>
            <field name="model">stock.partial.picking</field>
            <field name="inherit_id" ref="stock.stock_partial_picking_form"/>
            <field name="arch" type="xml">
                <field name="product_id" position="before">
                    <field name="product_id_ean13"/>
                </field>
            </field>
        </record>

    </data>
</openerp>

But when I'm trying to open form, getting the following error message:

Can't find field 'product_id_ean13' in the following view parts composing the view of object model 'stock.partial.picking': * stock.partial.picking.form

What I'm doing wrong?

0
kalmenchia
On 6/3/13, 9:34 AM

Hi,

Have you tried to update the db by issuing openerp-server.py -r dbuser -w dbpass -d db_to_be update --update=all

or go to the installation module and click upgrade.

may be your field not yet updated to the object.

0
Alexander
On 6/3/13, 10:17 AM

I'm forgot add folowing line into __init__.py.

import stock_partial_picking

I also had to override method:

def _partial_move_for (self, cr, uid, move):

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: 6/3/13, 7:38 AM
Seen: 2295 times
Last updated: 3/16/15, 8:10 AM