odex25_standard/odex25_donation/affiliate_management/models/affiliate_banner.py

35 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
#################################################################################
# Author : Webkul Software Pvt. Ltd. (<https://webkul.com/>:wink:
# Copyright(c): 2015-Present Webkul Software Pvt. Ltd.
# All Rights Reserved.
#
#
#
# This program is copyright property of the author mentioned above.
# You can`t redistribute it and/or modify it.
#
#
# You should have received a copy of the License along with this program.
# If not, see <https://store.webkul.com/license.html/>;
#################################################################################
from odoo import models, fields, api, _
from odoo.exceptions import UserError
import logging
_logger = logging.getLogger(__name__)
class AffiliateBanner(models.Model):
_name = "affiliate.banner"
_description = "Affiliate Banner Model"
banner_title = fields.Text(string="Banner Text")
banner_image = fields.Binary(string="Banner Image")
@api.model_create_multi
def create(self, vals_list):
res = None
for vals in vals_list:
if vals.get('banner_image') == False:
raise UserError("Image field is mandatory")
res = super(AffiliateBanner, self).create(vals)
return res