Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Don't send automatic e-mail when confirming quotation?

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
mailportalmail_threadodoo8.0
3 Risposte
9199 Visualizzazioni
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys,

When you have portal activated you'll get an automatic e-mail saying something along these lines:

 Quotation confirmed
    • Customer: Yenthe
    • Untaxed Amount: 1.

The problem is that I do not want this message to be e-mailed. Any message should be e-mailed to the customer when the portal is active, except this one.
The message is made by the function format_message in mail/mail_thread.py:

 def format_message(message_description, tracked_values):
            message = ''
            if message_description:
                message = '<span>%s</span>' % message_description
            for name, change in tracked_values.items():
                message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % change.get('col_info')
                if change.get('old_value'):
                    message += '%s &rarr; ' % change.get('old_value')
                message += '%s</div>' % change.get('new_value')
            return message
        if not tracked_fields:
            return True

This function posts the message to the view (in the chatter) but the problem is that somewhere else an action is triggered to send this message as an e-mail to the user.

So, my question, how can I / what is the best way to prevent this message to be send by email but allow anything else to be e-mailed to the customers?

Thanks,
Yenthe

1
Avatar
Abbandona
Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Autore Risposta migliore

Hi guys,

Found the solution myself. In the module mail is a Python file named mail_thread. In mail_thread.py is a function def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None): and inside this function you will find the following code:

 for subtype in subtypes:
                subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context)
                if not (subtype_rec and subtype_rec.exists()):
                    _logger.debug('subtype %s not found' % subtype)
                    continue
                message = format_message(subtype_rec.description if subtype_rec.description else subtype_rec.name, tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, subtype=subtype, context=context)
                posted = True
            if not posted:
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)

When you change the message variable in the first if condition there will be no more automatic messages e-mailed, not even when the portal is activated.Result:

 for subtype in subtypes:
                subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context)
                if not (subtype_rec and subtype_rec.exists()):
                    _logger.debug('subtype %s not found' % subtype)
                    continue
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)
                posted = True
            if not posted:
                message = format_message('', tracked_values)
                self.message_post(cr, uid, browse_record.id, body=message, context=context)
0
Avatar
Abbandona
Avatar
Axel Mendoza
Risposta migliore

You could read more about that here:

https://www.odoo.com/es_ES/forum/help-1/question/adding-messages-subtypes-for-product-changes-v7-91170#answer-91171

In your case you could disable that tracking of the needed fields just defining the field name in the _track dict with a lambda function that returns False like:

_track = {
    'field': {
'sale.mt_quotation.anything': lambda self, cr, uid, obj, ctx=None: False,
}
}
0
Avatar
Abbandona
Axel Mendoza

it will have the same results like you have with the change, the difference is that you need to define all the field tracked in your model in the _track dict

Ehtesham

I am facing the same issue, I want to mute only email for this subtype message "Quotation Confirmed". Trying your method now.

Ehtesham

Thanks, I just tried and it works as expected however I don't want to include all fields in my child model. I just want 'sale.mt_order_confirmed' to be set false. So in my child model instead of this _track = { 'state': { 'sale.mt_order_confirmed': lambda self, cr, uid, obj, ctx=None: False, 'sale.mt_order_sent': lambda self, cr, uid, obj, ctx=None: obj.state in ['sent'] }, } I want something like this _track['state']['sale.mt_order_confirmed'] = lambda self, cr, uid, obj, ctx=None: False Excuse my syntax I am new to Python, I just want to change the targeted field's specific state. just to be future proof.

Axel Mendoza

Then you are ready to vote the answer :). The other scenario that you describe require the extension of the message_track method in your model extension to support that behavior

Avatar
Roman Gsponer
Risposta migliore

If anyone wants to prevent from sending quotations (no matter if it's a portal-user or not) you can use this:


class NoQuotationSaleOrder(models.Model):
_inherit = 'sale.order'

@api.multi
def action_quotation_send(self):
self.ensure_one()

if self.state != "sale":
return False

# Use this if you want to use the access token in your email-template:
self._portal_ensure_token()

return super(NoQuotationSaleOrder, self).action_quotation_send()


0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Odoo 8 mail problems: Admin receives all messages / notification of new mails not working
mail odoo8.0
Avatar
0
lug 16
3987
'NoneType' object has no attribute 'id' on incoming mail server action.
mail mail_thread incomingemail
Avatar
0
giu 21
4212
Correct way to use multiple outgoing mailservers for multiple users? Risolto
mail mailserver odoo8.0
Avatar
Avatar
1
apr 21
12951
How to disable auto-add followers in discussion groups - copy solution from mail_thread.py?
follower mail odoo8.0
Avatar
Avatar
Avatar
2
mar 16
10361
odoo v8 mail_thread displaying received html email with table inside, table width wider than parent div width
mail v8 css mail_thread
Avatar
1
lug 16
4610
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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