Home > Enterprise >  How to Create Smart Buttons in Odoo 14
How to Create Smart Buttons in Odoo 14

Time:11-20

Good day, I want to get the payments of a client via a smart button in odoo 14. The code below gives me an error when i run it.

def action_payment_preview(self):
    action = self.env["ir.actions.actions"]._for_xml_id("account.view_account_payment_tree")
    action['domain'] = [('partner_id','=',self.id)]
    action['context'] = {'default_partner_id': self.id}
    return action

CodePudding user response:

Try this

def action_payment_preview(self):
    action = self.env["ir.actions.actions"]._for_xml_id("account.action_account_payments")
    action['domain'] = [('partner_id','=',self.id)]
    action['context'] = {'default_partner_id': self.id}
    return action
  • Related