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 override "def action_quotation_send"?

By
giordo
on 9/28/14, 8:49 AM 886 views

I try to override this method in portal_sale  to avoid custumer receive an email with a priced offer before a supervisor accept it. 

can someone help me?

def action_quotation_send(self, cr, uid, ids, context=None):
        ''' Override to use a modified template that includes a portal signup link '''
        action_dict = super(sale_order, self).action_quotation_send(cr, uid, ids, context=context)
        try:
            template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal_sale', 'em$
            # assume context is still a dict, as prepared by super
            ctx = action_dict['context']
            ctx['default_template_id'] = 5
            ctx['default_use_template'] = True
        except Exception:
            pass
        return action_dict

Thanks

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 9/30/14, 9:18 AM

Hi if you want to override a standard method, then you need not call super method of its...

When you use Super it is Inheriting, without it it is overriding...

So your method should be like this...

def action_quotation_send(self, cr, uid, ids, context=None):
        ''' Override to use a modified template that includes a portal signup link '''
               try:
            template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal_sale', 'em$
            # assume context is still a dict, as prepared by super
            ctx = action_dict['context']
            ctx['default_template_id'] = 5
            ctx['default_use_template'] = True
        except Exception:
            pass
        return action_dict
  [Note: Check the standard method's return value, and adapt the same here]

I have removed the line of calling the super method in your code

action_dict = super(sale_order, self).action_quotation_send(cr, uid, ids, context=context)

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

2 follower(s)

Stats

Asked: 9/28/14, 8:49 AM
Seen: 886 times
Last updated: 3/16/15, 8:10 AM