In Odoo 17 Enterprise, the payment method field isn't displayed by default on invoices because the system assumes that payment processing is managed via journal entries and bank reconciliation workflows. However, it is possible to customize this behavior to match your needs, especially for tasks like preparing SEPA debit payments.
Below are solutions to enable the payment method on invoices and filter invoices for batch payments:
1. Enable Payment Method on Invoices
Option 1: Use the Payment Journal as an Indicator
In Odoo, the Payment Journal field on the invoice represents where payments are processed. You can leverage this to specify payment methods indirectly.
Option 2: Add a Payment Method Field
You can add a custom field for Payment Method directly on the invoice form using either Odoo Studio or a custom module.
Using Odoo Studio:
- Go to Invoicing > Customers > Invoices.
- Open Odoo Studio.
- Drag and drop a Selection Field into the invoice form.
- Define the selection options for your payment methods:
- SEPA Debit
- Bank Transfer
- Credit Card
- Cash, etc.
- Save and apply your changes.
Using a Custom Module:
If you prefer coding, here’s how to add a payment_method field to the invoice (account.move) model:
pythonCopy codefrom odoo import models, fields
class AccountMove(models.Model):
_inherit = 'account.move'
payment_method = fields.Selection([
('sepa_debit', 'SEPA Debit'),
('bank_transfer', 'Bank Transfer'),
('credit_card', 'Credit Card'),
('cash', 'Cash'),
], string="Payment Method")
Add the field to the invoice form view:
xmlCopy code<record id="view_move_form_payment_method" model="ir.ui.view">
<field name="name">account.move.form.payment.method</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="payment_method" />
</xpath>
</field>
</record>
2. Use Payment Method for Filtering in Batch Payments
Scenario: Preparing SEPA Direct Debits
- SEPA Debit Management in Odoo:
- Odoo handles SEPA payments via Batch Payments in journals configured for SEPA Direct Debit. These can be managed in the Payments menu.
- Invoices need to be marked with SEPA as the payment method, either via a custom field or by linking them to a SEPA journal.
- Filter Invoices by Payment Method:
- Use the new payment_method field to filter invoices.
- Example: Add a filter in the Invoices view:
xmlCopy code<record id="view_move_tree_payment_method_filter" model="ir.ui.view">
<field name="name">account.move.tree.payment.method.filter</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_invoice_tree" />
<field name="arch" type="xml">
<xpath expr="//filter[@name='unpaid']" position="after">
<filter string="SEPA Debit" domain="[('payment_method', '=', 'sepa_debit')]" />
</xpath>
</field>
</record>
Filter in Batch Payments Preparation
When preparing batch payments (e.g., SEPA Direct Debit), Odoo will look for invoices linked to a journal supporting SEPA. With a payment_method field, you can:
- Pre-filter invoices with payment_method = 'sepa_debit'.
- Use automation to restrict batch payments to matching invoices.
3. Configure SEPA Journals for Automated Payments
- Go to Accounting > Configuration > Payment Journals.
- Create or configure a journal for SEPA payments:
- Set Payment Method Type to SEPA Direct Debit.
- Define Bank Account for the journal.
- Link invoices to the SEPA journal:
- Set the SEPA journal in the invoice payment journal field.
- Use batch payments to generate SEPA XML files.
4. Automate Payment Method Assignment
If certain customers always use a specific payment method:
- Add a payment_method field to the customer (res.partner):
pythonCopy codeclass ResPartner(models.Model):
_inherit = 'res.partner'
default_payment_method = fields.Selection([
('sepa_debit', 'SEPA Debit'),
('bank_transfer', 'Bank Transfer'),
('credit_card', 'Credit Card'),
('cash', 'Cash'),
], string="Default Payment Method")
- Auto-populate the payment_method field in invoices based on the customer:
pythonCopy codefrom odoo import models, api
class AccountMove(models.Model):
_inherit = 'account.move'
@api.onchange('partner_id')
def _onchange_partner_id(self):
if self.partner_id:
self.payment_method = self.partner_id.default_payment_method
5. Summary Workflow
- Add a Payment Method field to invoices (using Odoo Studio or custom code).
- Configure SEPA and other journals for different payment types.
- Use the payment_method field to filter and manage invoices for batch payments.
- (Optional) Automate payment method assignment for customers.