Skip to content
Snippets Groups Projects
Commit 659f045c authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Add button to update Stripe customer

Closes #13468
parent efd64643
No related branches found
No related tags found
No related merge requests found
* Add button to update customer
* Add Stripe pull button to payment
* Warn when changing credential
......
......@@ -1458,6 +1458,10 @@
'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'],
......@@ -1571,5 +1575,6 @@
}
@classmethod
@ModelView.button
def stripe_update(cls, customers):
for customer in customers:
......@@ -1574,5 +1579,7 @@
def stripe_update(cls, customers):
for customer in customers:
if not customer.stripe_customer_id:
continue
try:
stripe.Customer.modify(
customer.stripe_customer_id,
......
......@@ -273,6 +273,11 @@
<field name="name">stripe_checkout</field>
<field name="string">Add Card</field>
</record>
<record model="ir.model.button" id="customer_stripe_update_button">
<field name="model">account.payment.stripe.customer</field>
<field name="name">stripe_update</field>
<field name="string">Update</field>
</record>
<record model="ir.model.button" id="customer_source_detach_button">
<field name="model">account.payment.stripe.customer</field>
<field name="name">detach_source</field>
......
......@@ -13,6 +13,7 @@
<field name="stripe_customer_id"/>
<group id="buttons" col="-1" colspan="4">
<button name="stripe_checkout"/>
<button name="stripe_update"/>
<button name="detach_source"/>
<button name="find_identical"/>
</group>
......
......@@ -7,4 +7,5 @@
<field name="stripe_customer_id"/>
<field name="stripe_token"/>
<button name="stripe_checkout"/>
<button name="stripe_update"/>
</tree>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment