[IMP] website_payment: make it website specific
Allow to specity on a payment acquirer on if it is specific to one website or common to all.
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
@@ -15,6 +15,7 @@ This is a bridge module which integrates payment acquirers with Website app.
|
||||
],
|
||||
'data': [
|
||||
'views/res_config_settings_views.xml',
|
||||
'views/payment_acquirer.xml',
|
||||
],
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import payment_acquirer
|
||||
@@ -0,0 +1,9 @@
|
||||
# coding: utf-8
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class PaymentAcquirer(models.Model):
|
||||
_inherit = 'payment.acquirer'
|
||||
|
||||
website_id = fields.Many2one('website')
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="acquirer_form_webiste" model="ir.ui.view">
|
||||
<field name="name">acquirer.form.paypal</field>
|
||||
<field name="model">payment.acquirer</field>
|
||||
<field name="inherit_id" ref="payment.acquirer_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name='company_id' position='after'>
|
||||
<field name="website_id" options="{'no_open': True, 'no_create_edit': True}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -794,6 +794,7 @@ class WebsiteSale(http.Controller):
|
||||
|
||||
domain = expression.AND([
|
||||
['&', ('website_published', '=', True), ('company_id', '=', order.company_id.id)],
|
||||
['|', ('website_id', '=', False), ('website_id', '=', request.website.id)],
|
||||
['|', ('specific_countries', '=', False), ('country_ids', 'in', [order.partner_id.country_id.id])]
|
||||
])
|
||||
acquirers = request.env['payment.acquirer'].search(domain)
|
||||
|
||||
Reference in New Issue
Block a user