[IMP] payment: require name and image for payment method

Payment methods without image or without name does not make any sense.
Previously created payment methods without a name will be
given default name and ones without an image will be deleted.
Payment icon can no longer be created or edited from payment
provider form view.

task-2853424

closes odoo/odoo#105909

Related: odoo/upgrade#4043
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Anita (anko)
2023-01-26 18:50:52 +01:00
parent 415d1299f2
commit acb192eafb
2 changed files with 9 additions and 3 deletions
+5 -2
View File
@@ -8,12 +8,15 @@ class PaymentMethod(models.Model):
_description = 'Payment Method'
_order = 'sequence, name'
name = fields.Char(string="Name")
name = fields.Char(string="Name", required=True)
provider_ids = fields.Many2many(
string="Providers", comodel_name='payment.provider',
help="The list of providers supporting this payment method")
image = fields.Image(
string="Image", max_width=64, max_height=64,
string="Image",
max_width=64,
max_height=64,
required="True",
help="This field holds the image used for this payment method, limited to 64x64 px")
image_payment_form = fields.Image(
string="Image displayed on the payment form", related='image', store=True, max_width=45,
@@ -79,7 +79,10 @@
<group name="provider_config">
<group string="Payment Form" name="payment_form">
<field name="display_as" placeholder="If not defined, the provider name will be used."/>
<field name="payment_method_ids" attrs="{'invisible': [('show_payment_method_ids', '=', False)]}" widget="many2many_tags"/>
<field name="payment_method_ids"
options="{'no_create': True, 'no_edit': True}"
widget="many2many_tags"
attrs="{'invisible': [('show_payment_method_ids', '=', False)]}" />
<field name="allow_tokenization" attrs="{'invisible': ['|', ('support_tokenization', '=', False), ('show_allow_tokenization', '=', False)]}"/>
<field name="capture_manually" attrs="{'invisible': [('support_manual_capture', '=', False)]}"/>
<field name="allow_express_checkout" attrs="{'invisible': ['|', ('support_express_checkout', '=', False), ('show_allow_express_checkout', '=', False)]}"/>