summaryrefslogtreecommitdiff
path: root/addons/payment
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-09-25 11:55:55 +0000
committerDamien Bouvy <dbo@odoo.com>2019-09-30 16:20:40 +0000
commitb32132973c79129933bd8aaa7439e5bb5258fbc8 (patch)
tree1a60001849423e363c738e1465d6bc8c94c740e9 /addons/payment
parent0c4bae5b5e86ae05a73316ae83861de6733c3d2d (diff)
[IMP] payment : save related company_id on payment.token
Diffstat (limited to 'addons/payment')
-rw-r--r--addons/payment/models/account_payment.py6
-rw-r--r--addons/payment/models/payment_acquirer.py1
2 files changed, 5 insertions, 2 deletions
diff --git a/addons/payment/models/account_payment.py b/addons/payment/models/account_payment.py
index fe6f31eeb21..dc939989104 100644
--- a/addons/payment/models/account_payment.py
+++ b/addons/payment/models/account_payment.py
@@ -10,8 +10,10 @@ class AccountPayment(models.Model):
_inherit = 'account.payment'
payment_transaction_id = fields.Many2one('payment.transaction', string='Payment Transaction', readonly=True)
- payment_token_id = fields.Many2one('payment.token', string="Saved payment token", domain=[('acquirer_id.capture_manually', '=', False)],
- help="Note that tokens from acquirers set to only authorize transactions (instead of capturing the amount) are not available.")
+ payment_token_id = fields.Many2one(
+ 'payment.token', string="Saved payment token",
+ domain="[('acquirer_id.capture_manually', '=', False), ('company_id', '=', company_id)]",
+ help="Note that tokens from acquirers set to only authorize transactions (instead of capturing the amount) are not available.")
def _get_payment_chatter_link(self):
self.ensure_one()
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index 9f56664d7bd..f09a6466d49 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -1038,6 +1038,7 @@ class PaymentToken(models.Model):
short_name = fields.Char('Short name', compute='_compute_short_name')
partner_id = fields.Many2one('res.partner', 'Partner', required=True)
acquirer_id = fields.Many2one('payment.acquirer', 'Acquirer Account', required=True)
+ company_id = fields.Many2one(related='acquirer_id.company_id', store=True, index=True)
acquirer_ref = fields.Char('Acquirer Ref.', required=True)
active = fields.Boolean('Active', default=True)
payment_ids = fields.One2many('payment.transaction', 'payment_token_id', 'Payment Transactions')