Odoo18-Base/addons/website_sale_collect/models/payment_transaction.py
2025-01-06 10:57:38 +07:00

19 lines
666 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class PaymentTransaction(models.Model):
_inherit = 'payment.transaction'
def _post_process(self):
""" Override of `payment` to confirm orders with the on_site payment method and trigger
a picking creation. """
on_site_pending_txs = self.filtered(
lambda tx: tx.provider_id.custom_mode == 'on_site' and tx.state == 'pending'
)
on_site_pending_txs.sale_order_ids.filtered(
lambda so: so.state == 'draft'
).with_context(send_email=True).action_confirm()
super()._post_process()