Odoo Help


Convert lead to customer button [Closed]

on 8/27/15, 3:25 AM 895 views

The Question has been closed for reason: duplicate question

Jérémy Kersten (jke)
on 08/31/2015 14:33:01


I want to create button in lead form which creates customer by entered lead information and if creation was successfully deletes what lead and redirects to newly created customer.

I am not very experienced in python, but trying to learn something.

As I find out for the customer creation I have to call _create_lead_partner() function in crm_lead, so I created new module, inherited crm_lead class created my function which calls _create_lead_customer() function, but always missing something, getting error like TypeError: _create_lead_partner() got multiple values for keyword argument 'context'.

My function looks like what, 

def custom_create_contact(self, cr, uid, lead, context=None):

a = self._create_lead_partner(self, cr, uid, lead, context=None)

return a

I calls it with button

<button name="custom_create_contact" string="Create Customer" type="object" class="oe_highlight"/> 

On 8/31/15, 10:25 AM

maybe someone can tell me meaning of this error:

File "/opt/odoo/openerp/api.py", line 715, in __new__

self.registry = RegistryManager.get(cr.dbname)

AttributeError: 'crm.lead' object has no attribute 'dbname'

from my module i call other function from inherited class

my code

class crm_lead(models.Model):

_inherit = 'crm.lead'

def custom_create_contact(self, cr, uid, ids, context=None):

res = self.handle_partner_assignation(self, cr, uid, ids)

return res

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/27/15, 3:25 AM
Seen: 895 times
Last updated: 8/31/15, 2:33 PM