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

How to create custom crm_lead field based on next available sequence for each customer?

By
Rogério
on 7/21/14, 10:54 AM 695 views

Hello all,

 

I need to create a custom field for the Opportunities on “crm_lead” on Odoo V7

 

ABB.CC.DD

 

Where:

A = Company Id from res_partner.

BB = year last two digits.

CC = Customer Id from res_partner.

DD = Sequence Opportunities for the specific Customer.

 

Example :

 

A

1 My-Company New York

2 My-Company Los Angeles

3 My-Company Boston

 

BB

13 Year 2013

14 Year 2014

15 Year 2015

 

CC

43 Customer-A

44 Customer-B

45 Customer-C

 

Lets say we Have a data base with the entries:

 

114.43.01

114.43.02

114.44.01

114.45.01

 

Now I will create a new Opportunity entry, when I click “Save” it will check the next number available for the Customer.

 

For the Customer-A it will be: 114.43.03

For the Customer-B it will be: 114.44.02

For the Customer-C it will be: 114.45.02

 

Then, the new data base will be:

 

114.43.01

114.43.02

114.44.01

114.45.01

114.43.03

114.44.02

114.45.02

 

If I create new entries for “My-Company Boston” it will create the numbers:

 

For the Customer-A it will be: 314.43.01

For the Customer-B it will be: 314.44.01

For the Customer-C it will be: 314.45.01

 

Then, the new data base will be:

 

114.43.01

114.43.02

114.44.01

114.45.01

114.43.03

114.44.02

114.45.02

314.43.01

314.44.01

314.45.01

 

Thanks for any help!

0
Rogério
On 7/23/14, 1:47 PM

Thanks for answer. I understand that I have to write the code, but I d

on't know the best way to do it. Should I create a new table with the entries or use the existing table and just filter and count the entries.

If someboy has an similar example it will help me alot.

Thanks

you don't have to create a new table, you need to overwrite "create" method of 'crm.lead' class.

Yogesh
on 7/23/14, 11:05 PM
0
Nhomar Hernandez
On 7/22/14, 1:14 AM

Leads don't have this by default, you should overwrite with a custom module + an special sequence.

Thanks for answer. I understand that I have to write the code, but I d on't know the best way to do it. Should I create a new table with the entries or use the existing table and just filter and count the entries. If someboy has an similar example it will help me alot. Thanks

Rogério
on 9/2/14, 9:48 AM

Nhomar, Perdoneme, y perdone tambien por escribir en castellano, pero es que me es mas sencillo. Usted sabe si campos personalizados que son creados en el formulario de Leads, cuando este se convierte en Customer, ¿se pueden llevar esos datos de forma automatica revisando alguna característica de Odoo o bien hay que progrmar?

Mariano Rodrigo
on 11/25/14, 3:43 PM

Hay que programas

On Nov 25, 2014 2:43 PM, "Mariano Rodrigo" <mariano1800@gmail.com> wrote:

Nhomar, Perdoneme, y perdone tambien por escribir en castellano, pero es que me es mas sencillo. Usted sabe si campos personalizados que son creados en el formulario de Leads, cuando este se convierte en Customer, ¿se pueden llevar esos datos de forma automatica revisando alguna característica de Odoo o bien hay que progrmar?

--
Mariano Rodrigo
Sent by Odoo S.A. using Odoo about Forum Post False
Vauxoo S.A. de C.V., Nhomar Hernandez
on 11/25/14, 4:26 PM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/21/14, 10:54 AM
Seen: 695 times
Last updated: 3/16/15, 8:10 AM