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

Convert lead to customer button [Closed]

By
zilvinas
on 8/27/15, 3:25 AM 468 views

The Question has been closed for reason: duplicate question

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

Hello,

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"/> 


0
zilvinas
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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