Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] [contract_payment_auto] IntegrityError raised when token is related to the partner and not the contract #165

Closed
fcayre opened this issue May 22, 2018 · 1 comment

Comments

@fcayre
Copy link
Member

fcayre commented May 22, 2018

Traceback looks like:

xxxx:ERROR:odoo.addons.base.ir.ir_cron:Call of self.env[u'account.analytic.account'].cron_recurring_create_invoice(*()) failed in Job #6
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_cron.py", line 126, in _callback
    getattr(model, method_name)(*args)
  File "/opt/odoo_modules/contract/contract/models/account_analytic_account.py", line 304, in cron_recurring_create_invoice
    return contracts.recurring_create_invoice()
  File "/opt/odoo_modules/contract/contract/models/account_analytic_account.py", line 288, in recurring_create_invoice
    invoices |= contract.with_context(ctx)._create_invoice()
  File "/opt/odoo_modules/contract/contract_payment_auto/models/account_analytic_account.py", line 62, in _create_invoice
    self._do_auto_pay(invoice)
  File "/opt/odoo_modules/contract/contract_payment_auto/models/account_analytic_account.py", line 72, in _do_auto_pay
    self._pay_invoice(invoice)
  File "/opt/odoo_modules/contract/contract_payment_auto/models/account_analytic_account.py", line 94, in _pay_invoice
    self._get_tx_vals(invoice),
  File "/usr/lib/python2.7/dist-packages/odoo/addons/payment/models/payment_acquirer.py", line 497, in create
    tx = super(PaymentTransaction, self).create(values)
  File "/opt/odoo_modules/connector-telephony/base_phone/models/base.py", line 31, in create
    return super(Base, self).create(vals)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 3823, in create
    record = self.browse(self._create(old_vals))
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 3918, in _create
    cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
  File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 154, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 231, in execute
    res = self._obj.execute(query, params)
IntegrityError: null value in column "acquirer_id" violates not-null constraint
DETAIL:  Failing row contains (606, null, null, 2018-05-20 00:00:20.340395, FAC/18050428, 1, 1, null, null, null, 1, null, 29.00, draft, form, null, null, null, null, null, 2018-05-20 00:00:20.340395, null, null, null, null, null, null, null)

A pull request is coming soon. The bug is due to an inconsistency between the payment token existence tests in _pay_invoice and in _get_tx_vals.

fcayre added a commit to fcayre/contract that referenced this issue May 23, 2018
When a contrat had no payment token but the corresponding partner had
one, the transaction was created without an acquirer, leading to an
integrity error in postgres.

This change makes sure the token used to test the ability to pay an
invoice is passed along to the transaction creation call.

Tests were also added to check the ability to use the contract token if
present, but the partner's in the opposite case.

This change fixes OCA#165.
@pedrobaeza
Copy link
Member

Closing this as there's now a PR.

pedrobaeza pushed a commit that referenced this issue May 28, 2018
…en (#167)

When a contrat had no payment token but the corresponding partner had
one, the transaction was created without an acquirer, leading to an
integrity error in postgres.

This change makes sure the token used to test the ability to pay an
invoice is passed along to the transaction creation call.

Tests were also added to check the ability to use the contract token if
present, but the partner's in the opposite case.

This change fixes #165.
norlinhenrik pushed a commit to norlinhenrik/contract that referenced this issue Dec 19, 2019
…en (OCA#167)

When a contrat had no payment token but the corresponding partner had
one, the transaction was created without an acquirer, leading to an
integrity error in postgres.

This change makes sure the token used to test the ability to pay an
invoice is passed along to the transaction creation call.

Tests were also added to check the ability to use the contract token if
present, but the partner's in the opposite case.

This change fixes OCA#165.
fcayre added a commit to fcayre/contract that referenced this issue Mar 3, 2022
…en (OCA#167)

When a contrat had no payment token but the corresponding partner had
one, the transaction was created without an acquirer, leading to an
integrity error in postgres.

This change makes sure the token used to test the ability to pay an
invoice is passed along to the transaction creation call.

Tests were also added to check the ability to use the contract token if
present, but the partner's in the opposite case.

This change fixes OCA#165.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants