mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
This module allows to mark invoices as "selected for payment". This can be done in the list view of invoices using a button in the first column of the view which shows the selection status. This selection persists until a payment is registered.
18 lines
571 B
Python
18 lines
571 B
Python
# Copyright 2020 Camptocamp
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo import models
|
|
|
|
|
|
class AccountPayment(models.Model):
|
|
_inherit = "account.payment"
|
|
|
|
def action_register_payment(self):
|
|
active_ids = self.env.context.get("active_ids")
|
|
if active_ids:
|
|
invoices = self.env["account.move"].search(
|
|
[("id", "in", active_ids), ("selected_for_payment", "=", True)]
|
|
)
|
|
invoices.write({"selected_for_payment": False})
|
|
return super().action_register_payment()
|