Community mailing list archives

community@mail.odoo.com

INHERITANCE BY PROTOTYPE : FIELD NOT RECONGNIZED

by
Yassine TEIMI
- 12/02/2014 10:19:12

Dear all,

I'm working on stock.picking.out wich inherits by prototype from stock.picking, So , i want to add a field on

stock.picking.out, the inheritance by prototype says that every field added on stock.picking.out is not recognized by views, and that's what hapenning with me I guess.

Because I added a field num_bl on stock.picking.out (By custom module), and I overwrite a method ofstock.picking (force_assign), so I have now the following elements added to stock.picking.out, like this :

 class stock_picking_out(osv.osv):
    _name = "stock.picking.out"
    _inherit = "stock.picking"
    _table = "stock_picking"
    _description = "Delivery Orders"

  # Columns and other methods here #

    def force_assign(self, cr, uid, ids, *args):

        picking = self.browse(cr, uid, ids[0])
        num_bl = picking.num_bl
        if not num_bl:
            raise osv.except_osv(_('Attention !'), _('Numero BL est un champ obligatoire ! '))
        return super(stock_picking_out, self).force_assign(self, cr, uid, ids, *args)

 

When running the force_assign overriden method, it shows following error  Attribute error : Num_bl, it dosn't recognize the field num_bl, because of inheritance by prototype.

When I add the field num_bl manually ( direclty on source code without custom module) on stock_picking, it works, but it affects other databases, so I tried to add it on stock_picking with a custom module, but it shows only on the view_picking_form view, of stock_picking.

I am kind of confused, I'm looking for a solution that provides me adding the field on the stock_picking model (By custom module), exactly if I did it manually (direclty on the source code).

Any suggestions please ?


--

Cordialement

Yassine TEIMI

Ingénieur SI-BI & Consultant technico-fonctionnel ERP 

TEL : 06-56 15 31 47