Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Where to find code when creating an opportunity

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
modulescreatecustomersopportunity
2 Răspunsuri
6239 Vizualizări
Imagine profil
Anthony Gardiner

I've made a custom module for res.partner called "lastname"

If I am in the Customer Form and want to create a new opportunity, I select the "Opportunities" button

Most of the data is automatically populated, except for my custom fields

How do i add this capacity to my custom module?

What would the code be possibly?

Thanks in advance

-1
Imagine profil
Abandonează
Imagine profil
Qutechs, Ahmed M.Elmubarak
Cel mai bun răspuns

Hello,

The code that opening the opportunities from the button is defined here, you can see that the button calls an action with name:

%(crm.crm_case_category_act_oppor11)d

which you can find it here , the automatic population of the data comes from the context field:

1) in the button's context you'll find:

 context="{'search_default_partner_id': active_id}" 

this set the default search, so that when you click the button you'll find the search area 'right corner' populated with the partner's name more over if you click create you'll find the partner field populated with this one. [try to delete the search filter and press create, then you will miss the partner].

2) in the action's context you'll find:


 <field name="context">{
'stage_type': 'opportunity',
'default_type': 'opportunity',
'default_user_id': uid
}
</field>

you can set a default value in a field by using 'default_your_field': your_value, in the context dict.

You can edit this context to add the default value of your fields.

* Note: you said that you added some fields to res.partner , but I think you've to add your fields to Opportunity's model to be able to but I think you've to add your fields to Opportunity's model to be able to set the default values to them ....

-Also you can populate it by using an on_change function ...

*BTW I didn't down voted your question ...


I hope this will be helpful 

0
Imagine profil
Abandonează
Imagine profil
Solanki Shamji
Cel mai bun răspuns

Hello,

I think this will helpful you.

see crm_lead.py in crm module.

Here in class crm_lead(format_address, osv.osv):

See below method. You can overwrite this method for your custom field.

def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
print 'onchange partner idddd'
values = {}
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
values = {
'partner_name': partner.parent_id.name if partner.parent_id else partner.name,
'contact_name': partner.name if partner.parent_id else False,
'street': partner.street,
'street2': partner.street2,
'city': partner.city,
'state_id': partner.state_id and partner.state_id.id or False,
'country_id': partner.country_id and partner.country_id.id or False,
'email_from': partner.email,
'phone': partner.phone,
'mobile': partner.mobile,
'fax': partner.fax,
'zip': partner.zip,
}
return {'value': values}
3
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Change "create" button label in developer mode ???
create customers
Imagine profil
Imagine profil
1
ian. 16
4922
self.create() command in OpenERP Model object not working well?
modules models create
Imagine profil
Imagine profil
Imagine profil
2
mar. 15
8966
Skipping Create Methode with a Condition
create orm customers Odoo13.0 curser
Imagine profil
1
iul. 20
32
Nuevo menú en "CRM"
modules
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
iul. 25
2972
Allow Access to update module
modules
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
mai 25
4897
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now