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

[15.0] account_payment_order: Error in Batch Payments when deleting a Batch Content line #992

Closed
antony-psc opened this issue Dec 6, 2022 · 2 comments · Fixed by #1000
Closed
Labels

Comments

@antony-psc
Copy link
Contributor

Module

account_payment_order

Describe the bug

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/api.py", line 886, in get
return field_cache[record._ids[0]]
KeyError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/fields.py", line 1061, in get
value = env.cache.get(record, self)
File "/home/odoo/src/odoo/odoo/api.py", line 889, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'account.payment(,).available_payment_method_line_ids'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/models.py", line 5204, in ensure_one
_id, = self._ids
ValueError: too many values to unpack (expected 1)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 916, in call
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1342, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1334, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/models.py", line 6450, in onchange
snapshot0.fetch(name)
File "/home/odoo/src/odoo/odoo/models.py", line 6284, in fetch
self[name] = [Snapshot(line, tree[name]) for line in record[name]]
File "/home/odoo/src/odoo/odoo/models.py", line 6284, in
self[name] = [Snapshot(line, tree[name]) for line in record[name]]
File "/home/odoo/src/odoo/odoo/models.py", line 6276, in init
self.fetch(name)
File "/home/odoo/src/odoo/odoo/models.py", line 6284, in fetch
self[name] = [Snapshot(line, tree[name]) for line in record[name]]
File "/home/odoo/src/odoo/odoo/models.py", line 5893, in getitem
return self._fields[key].get(self, type(self))
File "/home/odoo/src/odoo/odoo/fields.py", line 2611, in get
return super().get(records, owner)
File "/home/odoo/src/odoo/odoo/fields.py", line 1110, in get
self.compute_value(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1269, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 411, in _compute_field_value
return super()._compute_field_value(field)
File "/home/odoo/src/odoo/odoo/models.py", line 4255, in _compute_field_value
getattr(self, field.compute)()
File "/home/odoo/src/user/OCA/bank-payment/account_payment_order/models/account_payment.py", line 23, in _compute_payment_method_line_fields
to_exclude = self._get_payment_method_codes_to_exclude()
File "/home/odoo/src/enterprise/account_sepa_direct_debit/models/account_payment.py", line 220, in _get_payment_method_codes_to_exclude
res = super(AccountPayment, self)._get_payment_method_codes_to_exclude()
File "/home/odoo/src/odoo/addons/account/models/account_payment.py", line 437, in _get_payment_method_codes_to_exclude
self.ensure_one()
File "/home/odoo/src/odoo/odoo/models.py", line 5207, in ensure_one
raise ValueError("Expected singleton: %s" % self)
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Expected singleton: account.payment(, )

To Reproduce

Affected versions:

Steps to reproduce the behavior:
1.Create Batch Payments
2.Add multiple lines in Batch Content
3.Save
4.Delete a line in Batch Content

Expected behavior
Delete Batch Content line

Additional context
enterprise/account/models/account_payment.py line 425

https://github.com/OCA/bank-payment/blob/15.0/account_payment_order/models/account_payment.py#L23
change 'self' to 'pay' to fix the error

@antony-psc antony-psc added the bug label Dec 6, 2022
@pedrobaeza
Copy link
Member

Can you please do the PR with the fix?

@antony-psc
Copy link
Contributor Author

ok I'm going to upload it with a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants