[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:
@@ -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):
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user