mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 17:12:00 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class PaymentProvider(models.Model):
|
||||
_inherit = 'payment.provider'
|
||||
|
||||
@api.model
|
||||
def _get_compatible_providers(self, *args, website_id=None, **kwargs):
|
||||
""" Override of payment to only return providers matching website-specific criteria.
|
||||
|
||||
In addition to the base criteria, the website must either not be set or be the same as the
|
||||
one provided in the kwargs.
|
||||
|
||||
:param int website_id: The provided website, as a `website` id
|
||||
:return: The compatible providers
|
||||
:rtype: recordset of `payment.provider`
|
||||
"""
|
||||
providers = super()._get_compatible_providers(*args, website_id=website_id, **kwargs)
|
||||
if website_id:
|
||||
providers = providers.filtered(
|
||||
lambda p: not p.website_id or p.website_id.id == website_id
|
||||
)
|
||||
return providers
|
||||
Loading…
Add table
Add a link
Reference in a new issue