i would like to know how to override create method in the new odoo API. to replace this :
def create(self, cr, uid, vals, context=None):
new_id = super(CRM_Lead, self).create(cr, uid, vals, context=context)
lead = self.browse(cr, uid, new_id, context=context)
self._compute_stage_deadline(cr, uid, lead, context)
Yo can see an example here:
_inherit = "account.journal"
def create(self, vals):
rec = super(AccountJournal, self).create(vals)
Make sure you use the exact name of the python class in the super function and also that you return the same object you get from it.
please see the below link from v7 to new API code
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
|Asked: 8/11/14, 3:44 AM|
|Seen: 15390 times|
|Last updated: 11/26/15, 5:11 AM|