Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
268 Vistas

Hi All,

I want to send the customer statement in bulk.

how can I do that?

Avatar
Descartar
Mejor respuesta

Hi,


Odoo only lets you send statements individually.

For bulk sending, you have two good options:


    Install an OCA module that extends statements with mass send features.

    Or implement a custom server action / scheduled job that generates PDFs and sends them via email templates automatically.


- Automated Server Action / Scheduled Action


    You can create a scheduled job that:


        Loops through all customers with an open balance.


        Generates the customer statement PDF (report_action).


        Sends it by email using an email template.


Example (Python in server action / cron job):


partners = env['res.partner'].search([('customer_rank', '>', 0)])

for partner in partners:

    # Generate statement report

    pdf = env.ref('account_reports.action_report_partner_statement')._render_qweb_pdf([partner.id])[0]

    attachment = env['ir.attachment'].create({

        'name': f'Statement_{partner.name}.pdf',

        'type': 'binary',

        'datas': base64.b64encode(pdf),

        'res_model': 'res.partner',

        'res_id': partner.id,

        'mimetype': 'application/pdf'

    })

    # Send email

    template = env.ref('your_module.email_template_partner_statement')

    env['mail.template'].browse(template.id).send_mail(partner.id, force_send=True)


For more information, refer to the following


OCA Module


* https://odoo-community.org/shop/partner-statement-4804#attr=2869

* https://odoo-community.org/shop/account-financial-reports-196#attr=942162


References


*https://www.cybrosys.com/blog/overview-of-customer-statement-in-odoo-18-accounting

* https://www.odoo.com/documentation/17.0/applications/finance/accounting/payments/follow_up.html#follow-up-reports

* https://www.odoo.com/sl_SI/forum/pomoc-1/customer-statements-237640


Hope it helps

Avatar
Descartar