From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../wizard/payment_acquirer_onboarding_wizard.py | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 addons/sale/wizard/payment_acquirer_onboarding_wizard.py (limited to 'addons/sale/wizard/payment_acquirer_onboarding_wizard.py') diff --git a/addons/sale/wizard/payment_acquirer_onboarding_wizard.py b/addons/sale/wizard/payment_acquirer_onboarding_wizard.py new file mode 100644 index 00000000..6a7f3b37 --- /dev/null +++ b/addons/sale/wizard/payment_acquirer_onboarding_wizard.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models + + +class PaymentWizard(models.TransientModel): + """ Override for the sale quotation onboarding panel. """ + + _inherit = 'payment.acquirer.onboarding.wizard' + _name = 'sale.payment.acquirer.onboarding.wizard' + _description = 'Sale Payment acquire onboarding wizard' + + def _get_default_payment_method(self): + return self.env.company.sale_onboarding_payment_method or 'digital_signature' + + payment_method = fields.Selection(selection_add=[ + ('digital_signature', "Electronic signature"), + ('paypal', "PayPal"), + ('stripe', "Credit card (via Stripe)"), + ('other', "Other payment acquirer"), + ('manual', "Custom payment instructions"), + ], default=_get_default_payment_method) + # + + def _set_payment_acquirer_onboarding_step_done(self): + """ Override. """ + self.env.company.sudo().set_onboarding_step_done('sale_onboarding_order_confirmation_state') + + def add_payment_methods(self, *args, **kwargs): + self.env.company.sale_onboarding_payment_method = self.payment_method + if self.payment_method == 'digital_signature': + self.env.company.portal_confirmation_sign = True + if self.payment_method in ('paypal', 'stripe', 'other', 'manual'): + self.env.company.portal_confirmation_pay = True + + return super(PaymentWizard, self).add_payment_methods(*args, **kwargs) -- cgit v1.2.3