summaryrefslogtreecommitdiff
path: root/addons/website_sale_coupon/models/sale_coupon.py
blob: 0b8029ef8734026d78b2b85a6b9814b0ffa767ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import models


class SaleCoupon(models.Model):
    _inherit = 'coupon.coupon'

    def _check_coupon_code(self, order):
        if self.program_id.website_id and self.program_id.website_id != order.website_id:
            return {'error': 'This coupon is not valid on this website.'}
        return super()._check_coupon_code(order)