From 66fc3d379af1056a7594482742d1bfcd950a5291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 4 Aug 2017 00:35:11 +0200 Subject: [PATCH] Allow to create customer with ID issue6685 review39581002 --- CHANGELOG | 1 + payment.py | 10 ++++++++-- view/customer_form.xml | 4 ++-- view/customer_list.xml | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f7ea954a93..4ae6fde269 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Allow to create customer with ID * Allow to create manual payment * Add capture diff --git a/payment.py b/payment.py index 9a86dd6a7a..93a6259643 100644 --- a/payment.py +++ b/payment.py @@ -364,7 +364,13 @@ class Customer(ModelSQL, ModelView): stripe_checkout_needed = fields.Function( fields.Boolean("Stripe Checkout Needed"), 'get_stripe_checkout_needed') stripe_checkout_id = fields.Char("Stripe Checkout ID", readonly=True) - stripe_customer_id = fields.Char("Stripe Customer ID", readonly=True) + stripe_customer_id = fields.Char( + "Stripe Customer ID", + states={ + 'readonly': ((Eval('stripe_customer_id') | Eval('stripe_token')) + & (Eval('id', -1) >= 0)), + }, + depends=['stripe_token']) stripe_token = fields.Char("Stripe Token", readonly=True) stripe_error_message = fields.Char("Stripe Error Message", readonly=True, states={ @@ -394,7 +400,7 @@ class Customer(ModelSQL, ModelView): return True def get_stripe_checkout_needed(self, name): - return not self.stripe_token + return not self.stripe_customer_id and not self.stripe_token def get_rec_name(self, name): name = super(Customer, self).get_rec_name(name) diff --git a/view/customer_form.xml b/view/customer_form.xml index 0c97042a54..cc9b35d66a 100644 --- a/view/customer_form.xml +++ b/view/customer_form.xml @@ -9,8 +9,8 @@ this repository contains the full copyright notices and license terms. -->