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

Where is defined such a modal dialog view?

By
Pascal Tremblay
on 12/26/14, 8:24 AM 1,905 views

Hello friends,

I'm not able to find the definition of this popup windows. Is it in the database? In a .py file?

Thanks

I want to see the code who constructs the « Use template » section in the bottom at right. My goal is really to change the default value of « Use template » field. 

 

0

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 12/26/14, 10:09 AM

In ir.ui.view, I have found sale.order.form :

 <button name="action_quotation_send" string="Send by Email" type="object" states="sent,progress,manual" groups="base.group_user"/>


In the file addons/sale/sale.py, we have the definition of action_quotation_send :

    def action_quotation_send(self, cr, uid, ids, context=None):
        '''
        This function opens a window to compose an email, with the edi sale template message loaded by default
        '''
        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
        ir_model_data = self.pool.get('ir.model.data')
        try:
            template_id = ir_model_data.get_object_reference(cr, uid, 'sale', 'email_template_edi_sale')[1]
        except ValueError:
            template_id = False
        try:
            compose_form_id = ir_model_data.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')[1]
        except ValueError:
            compose_form_id = False
        ctx = dict()
        ctx.update({
            'default_model': 'sale.order',
            'default_res_id': ids[0],
            'default_use_template': bool(template_id),
            'default_template_id': template_id,
            'default_composition_mode': 'comment',
            'mark_so_as_sent': True
        })
        return {
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'mail.compose.message',
            'views': [(compose_form_id, 'form')],
            'view_id': compose_form_id,
            'target': 'new',
            'context': ctx,
        }

 

they dont use template....

Anand
on 12/26/14, 10:11 AM

Yes you are right Anand.

Pascal Tremblay
on 12/28/14, 8:00 AM
1
Anand
On 12/26/14, 8:28 AM

Hi Pascal, this will open the window

  return {
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'mail.compose.message',
            'views': [(compose_form_id, 'form')],
            'view_id': compose_form_id,
            'target': 'new',
            'context': ctx,
        }

Thanks. I have already found this in the file addons/sale/sale.py file. I don't understand where is stocked the view. Does this view exist? I was searching for « compose_for_id » or « mail.compose.message », but I don't find it in the database...

Pascal Tremblay
on 12/26/14, 8:33 AM

yes.. there is a database named "mail.compose.message"... and but there is no data.. actually if u read it fully.. u may see compose_form_id is a result of filtering email template..... so a temporary view is created and message is send...

Anand
on 12/26/14, 8:51 AM

I analyze all of this. Come back soon. Thanks

Pascal Tremblay
on 12/26/14, 8:52 AM

Thanks Anand.

Pascal Tremblay
on 12/28/14, 8:00 AM

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: 12/26/14, 8:24 AM
Seen: 1905 times
Last updated: 3/16/15, 8:10 AM