diff --git a/modules/account_payment_braintree/CHANGELOG b/modules/account_payment_braintree/CHANGELOG index 3567c3a437..5657a10e15 100644 --- a/modules/account_payment_braintree/CHANGELOG +++ b/modules/account_payment_braintree/CHANGELOG @@ -1,3 +1,4 @@ +* Add button to update customer * Warn when changing credential Version 7.2.0 - 2024-04-29 diff --git a/modules/account_payment_braintree/account.py b/modules/account_payment_braintree/account.py index 6e99f2874e..1728f9bffe 100644 --- a/modules/account_payment_braintree/account.py +++ b/modules/account_payment_braintree/account.py @@ -975,6 +975,10 @@ class PaymentBraintreeCustomer( 'invisible': Bool(Eval('braintree_nonce')), 'depends': ['braintree_nonce'], }, + 'braintree_update': { + 'invisible': ~Eval('braintree_customer_id'), + 'depends': ['braintree_customer_id'], + }, 'delete_payment_method': { 'invisible': ~Eval('braintree_customer_id'), 'depends': ['braintree_customer_id'], @@ -1083,8 +1087,11 @@ class PaymentBraintreeCustomer( return params @classmethod + @ModelView.button def braintree_update(cls, customers): for customer in customers: + if not customer.braintree_customer_id: + continue gateway = customer.braintree_account.gateway() try: gateway.customer.update( diff --git a/modules/account_payment_braintree/account.xml b/modules/account_payment_braintree/account.xml index 35f4f376ab..ac32d3b946 100644 --- a/modules/account_payment_braintree/account.xml +++ b/modules/account_payment_braintree/account.xml @@ -293,6 +293,11 @@ this repository contains the full copyright notices and license terms. --> braintree_checkout Add Card + + account.payment.braintree.customer + braintree_update + Update + account.payment.braintree.customer|braintree_create diff --git a/modules/account_payment_braintree/view/customer_form.xml b/modules/account_payment_braintree/view/customer_form.xml index aaab2cff57..25cf9d6ff1 100644 --- a/modules/account_payment_braintree/view/customer_form.xml +++ b/modules/account_payment_braintree/view/customer_form.xml @@ -16,6 +16,7 @@ this repository contains the full copyright notices and license terms. -->