[IMP] payment: Fix crash on install

- Fixed a crash when installing payment module.
- Set a more specific css selector to display error on payment form where required input are empty
This commit is contained in:
tbe-odoo
2017-08-29 17:13:58 +02:00
parent f74111f79f
commit 83fdc63b68
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -428,7 +428,7 @@ class PaymentOption(models.Model):
image_resize_images(vals)
if 'image' in vals:
self.image_payment_form = image_resize_image(vals['image'], size=(45,30))
vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30))
return super(PaymentOption, self).create(vals)
@@ -436,7 +436,7 @@ class PaymentOption(models.Model):
def write(self, vals):
image_resize_images(vals)
if 'image' in vals:
self.image_payment_form = image_resize_image(vals['image'], size=(45,30))
vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30))
return super(PaymentOption, self).write(vals)
class PaymentTransaction(models.Model):
+4 -4
View File
@@ -41,10 +41,10 @@ odoo.define('payment.payment_form', function (require){
inputs_form.toArray().forEach(function(element) {
if(element.dataset.isRequired) {
if (element.value.length === 0) {
$(element).closest('div').addClass('has-error');
$(element).closest('div.form-group').addClass('has-error');
}
else {
$(element).closest('div').removeClass('has-error');
$(element).closest('div.form-group').removeClass('has-error');
}
empty_inputs = true;
}
@@ -181,10 +181,10 @@ odoo.define('payment.payment_form', function (require){
inputs_form.toArray().forEach(function(element) {
if(element.dataset.isRequired) {
if (element.value.length === 0) {
$(element).closest('div').addClass('has-error');
$(element).closest('div.form-group').addClass('has-error');
}
else {
$(element).closest('div').removeClass('has-error');
$(element).closest('div.form-group').removeClass('has-error');
}
empty_inputs = true;
}