top of page
  • Writer's pictureTek Siong, Hock

Odoo - Server Action on Multiple Records

If you have a requirement to perform certain action on multiple records with a single click, eg, approve multiple payments, then you may consider using the server action.

Select and click "Approve" to approve the multiple vendor payments.

Add the server action "ir.actions.server" model in the xml view, to call action_vendor_payment_approve method in the account.payment class.

<record model="ir.actions.server" id="action_vendor_payment_approve">
    <field name="name">Approve</field>
    <field name="model_id" ref="account.model_account_payment"/>
    <field name="binding_model_id" ref="account.model_account_payment" />
    <field name="state">code</field>
    <field name="code">
        if records:
        action = records.action_vendor_payment_approve()

def action_vendor_payment_approve(self):
    for payment in self:
        payment.write({'state': 'draft'})
        payment.approve_by =
        payment.approve_date_time =

153 views0 comments

Recent Posts

See All

Let the AI answer your questions based on your Odoo data

bottom of page