Skip to content

Commit

Permalink
[IMP] Add force company in create account payment from payment transa…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
maq-adhoc committed May 4, 2023
1 parent d7ef599 commit e256270
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions payment_multic_ux/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from . import payment_provider
from . import payment_transaction
from . import account_payment
12 changes: 12 additions & 0 deletions payment_multic_ux/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from odoo import models


class AccountPayment(models.Model):
_inherit = 'account.payment'

def create(self, val_list):
force_company = self.env.context._get('force_company')
if force_company:
for vals in val_list:
vals['company_id'] = force_company
return super().create(val_list)
9 changes: 9 additions & 0 deletions payment_multic_ux/models/payment_transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import models


class PaymentTransaction(models.Model):
_inherit = 'payment.transaction'

def _create_payment(self, **extra_create_values):
# Add force_company to catch later in the account.payment creation.
return super().with_context(force_company = self.provider_id.journal_id.company_id.id)._create_payment(**extra_create_values)

0 comments on commit e256270

Please sign in to comment.