clicking a button added to the schedule activity trigger a weird behavior odoo14

  odoo, odoo-14, python, xml

when adding a button to mail.mail_activity_view_form_popup popup related to some custom functionality when clicking the new button it triggers the schedule button in the popup while stoping the custom button functionality

here is an example of me trying to open a new wizard

class CustomMailActivity(models.Model):
    _inherit = 'mail.activity'
    def inspection_visit_call(self):
        self.env['res.partner'].search([('id', '=', self.res_id)]).open_custom_edit_form()

 class inspection(models.Model):
    _inherit = 'res.partner'
    ...
    def open_custom_edit_form(self):
        return {

            'name': 'Purchase Order',

            'type': 'ir.actions.act_window',

            'res_model': 'purchase.order',

            'view_mode': 'tree,form',

            'target': 'current',

            'context': "{'create': False}"}

the view part

    <field name="name">mail.activity</field>

    <field name="model">mail.activity</field>

    <field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>

    <field name="arch" type="xml">

        <xpath expr="//field[@name='summary']" position="after">

            <div>



 <button style="width:40%;margin-left:10px" type="object" name="inspection_visit_call"

                        class="btn btn-info" string="visit"     />

            </div>

        </xpath>

    </field>

</record>

Source: Python Questions

LEAVE A COMMENT