Abraham Kalungi
Abraham Kalungi

Reputation: 27

How to Create Smart Buttons in Odoo 14

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

Upvotes: 0

Views: 311

Answers (1)

Haresh Shyara
Haresh Shyara

Reputation: 1886

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

Upvotes: 1

Related Questions