Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to override the contactus class of the website_crm module to send mail instead of creating a lead?

Odebírat

Get notified when there's activity on this post

This question has been flagged
messagemailformpostthread
1 Odpovědět
6820 Zobrazení
Avatar
Pascal Tremblay

Hello guys,

Our goal is to send a email to administrator instead of creating a lead via the website_crm form.

But I'm not able to override correctly the contactus class and his create_lead method to correctly send an email instead of creating a lead.

Here is my last try. It doesn't work. (error is : Model contactus_pt is declared but cannot be loaded!)

from openerp.addons.website_crm.controllers.main import contactus

class contactus_pt(osv.AbstractModel):

_inherit = ['mail.thread']

def create_lead(self, request, values, kwargs):

""" Allow to be overrided """

cr, context = request.cr, request.context

self.message_post(cr, uid, [new_id], body=_("pasdfas"), context=ctx)

return request.registry['crm.lead'].create(cr, SUPERUSER_ID, values, context=dict(context, mail_create_nosubscribe=True))


The message_post method has to work! I need it there. I will adjust all the parameters. But now, the class is not even loaded.

Please help. I'm tired of this problem!


0
Avatar
Zrušit
Avatar
Emipro Technologies Pvt. Ltd.
Nejlepší odpověď

Your problem is automatically resolve when you use default inheritance of the python language.

Please see the inheritance of the python and your solution in below code.

import openerp.addons.website_crm.controllers.main as website_crm_main
class contactus_pt(website_crm_main.contactus):
    def create_lead(self, request, values, kwargs):
        """ Allow to be overrided """
        cr, context = request.cr, request.context
        new_id = request.registry['crm.lead'].create(cr, SUPERUSER_ID, values, context=dict(context, mail_create_nosubscribe=True))
request.registry['crm.lead'].message_post(cr, uid, [new_id], body=_("pasdfas"), context=context)
        return new_id

Here according to python we have import main package from website_crm. And we have inherit contactus class inside our custom class "contactus_pt". 

This inheritance is a pure/basic python inheritance. Inside any web or website controller we can not make changes as like Odoo module. We have to use default python concept.

This is very important and less knowing things which I am going to share over here.

I am sure your issue will resolve.

Thanks. 


1
Avatar
Zrušit
Pascal Tremblay
Autor

Your inheritance works well. the class contactus_pt is loaded. But the message_post method doesn't work. I get this error ««« 'contactus (extended by contactus_pt)' object has no attribute 'message_post' »»». This is the real problem because message_post is not a real method of the class website_crm_main.contactus. How to add this new message_post method to the class? THanks to you

Emipro Technologies Pvt. Ltd.

Hello, I have just update my answer. It is so simple no need of the message_post method. Just have a look on the updated answer.

Pascal Tremblay
Autor

I have tried your code. Thanks. But I don't receive the message. The new_id variable take the id of the new created lead. ok But I don't see any message anywhere. I don't receive email.

Pascal Tremblay
Autor

I forgot to say that I have no error in the log. But i don't receive any meSsage. Where should the message be?

Emipro Technologies Pvt. Ltd.

you can see one message inside communication section of that newly created lead.

Pascal Tremblay
Autor

Ok, I open the new created lead and I see below it, in the communication section, the message posted. You answered my question very well. Thanks.

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
How to receive messages from this form (website_crm)?
message mail crm form website
Avatar
Avatar
1
lis 15
5681
Comment fonctionne la boite de réception de odoo
message mail
Avatar
0
čvn 25
1116
Finding solution: instagram integration with Odoo Live Chat, Discuss Module
message mail
Avatar
Avatar
1
kvě 25
2513
How can odoo show internal message to portal user
message mail
Avatar
0
led 21
2978
[9.0]Try to Hide button in widget: mail_thread
message mail
Avatar
0
bře 19
6011
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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