diff --git a/modules/account_payment_stripe/CHANGELOG b/modules/account_payment_stripe/CHANGELOG
index 140b9876e6..9597b81aea 100644
--- a/modules/account_payment_stripe/CHANGELOG
+++ b/modules/account_payment_stripe/CHANGELOG
@@ -1,3 +1,4 @@
+* Add button to update customer
* Add Stripe pull button to payment
* Warn when changing credential
diff --git a/modules/account_payment_stripe/payment.py b/modules/account_payment_stripe/payment.py
index afb8b3553b..b900681237 100644
--- a/modules/account_payment_stripe/payment.py
+++ b/modules/account_payment_stripe/payment.py
@@ -1459,6 +1459,10 @@ class Customer(CheckoutMixin, DeactivableMixin, ModelSQL, ModelView):
'invisible': ~Eval('stripe_checkout_needed', False),
'depends': ['stripe_checkout_needed'],
},
+ 'stripe_update': {
+ 'invisible': ~Eval('stripe_customer_id'),
+ 'depends': ['stripe_customer_id'],
+ },
'detach_source': {
'invisible': ~Eval('stripe_customer_id'),
'depends': ['stripe_customer_id'],
@@ -1572,8 +1576,11 @@ class Customer(CheckoutMixin, DeactivableMixin, ModelSQL, ModelView):
}
@classmethod
+ @ModelView.button
def stripe_update(cls, customers):
for customer in customers:
+ if not customer.stripe_customer_id:
+ continue
try:
stripe.Customer.modify(
customer.stripe_customer_id,
diff --git a/modules/account_payment_stripe/payment.xml b/modules/account_payment_stripe/payment.xml
index be4eec4c86..95d7af04b2 100644
--- a/modules/account_payment_stripe/payment.xml
+++ b/modules/account_payment_stripe/payment.xml
@@ -273,6 +273,11 @@ this repository contains the full copyright notices and license terms. -->
stripe_checkout
Add Card
+
+ account.payment.stripe.customer
+ stripe_update
+ Update
+
account.payment.stripe.customer
detach_source
diff --git a/modules/account_payment_stripe/view/customer_form.xml b/modules/account_payment_stripe/view/customer_form.xml
index f9f58fc0cd..bc94c319dd 100644
--- a/modules/account_payment_stripe/view/customer_form.xml
+++ b/modules/account_payment_stripe/view/customer_form.xml
@@ -13,6 +13,7 @@ this repository contains the full copyright notices and license terms. -->
+
diff --git a/modules/account_payment_stripe/view/customer_list.xml b/modules/account_payment_stripe/view/customer_list.xml
index 46584e5cfa..47e5bdb286 100644
--- a/modules/account_payment_stripe/view/customer_list.xml
+++ b/modules/account_payment_stripe/view/customer_list.xml
@@ -7,4 +7,5 @@ this repository contains the full copyright notices and license terms. -->
+