diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/sale/wizard/payment_acquirer_onboarding_wizard.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/sale/wizard/payment_acquirer_onboarding_wizard.py')
| -rw-r--r-- | addons/sale/wizard/payment_acquirer_onboarding_wizard.py | 37 |
1 files changed, 37 insertions, 0 deletions
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) |
