Community mailing list archives
community@mail.odoo.com
Browse archives
Re: Functional overriding
byHello Peter,
In your cash maybe this will be help you.
class stock_quant(osv.osv):
_inherit = 'stock.quant'
def _calc_inventory_values(self, cr, uid, ids, name, attr, context=None):
RS=super(stock_quant, self)
res=RS._calc_inventory_value(cr, uid, ids, name,attr, context=None)
return res
and the functional field is:
_columns = { 'inventory_value': fields.function(_calc_inventory_values, string="Inventory Value", type='float', readonly=True),}On Wed, Feb 24, 2016 at 3:06 PM, Houssine BAKKALI <houssine.bakkali@gmail.com> wrote:You better use new api for this or switch you import and model declaration to the old api...you seem to use old api with models.Modelso if you imported the fields from the same place that the models It will not work.2016-02-24 10:13 GMT+01:00 Peter Mudoko <petypi@gmail.com>:Hi guys am trying to overide a fumctional field in stocks(stocks_quant) _calc_inventory_value, as follows:
class mrp_extend(models.Model):
_inherit = 'mrp.bom'
def _calc_inventory_values(self, cr, uid, ids, name, attr, context=None):
RS=super(stock_quant, self)
res=RS._calc_inventory_value(cr, uid, ids, name,attr, context=None)
return res
and the functional field is:
_columns = { 'inventory_value': fields.function(_calc_inventory_values, string="Inventory Value", type='float', readonly=True),}
But am getting 'TypeError: super(type, obj): obj must be an instance or subtype of type' any help kindly.
Laballieds,
Nairobi:gate 256, Nairobi.
P.O.Box - 45855 -00100, Nairobi.
Tel:+254 721449067
Mobile: +254 721449067
Website www.softlinkoptions.com
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe