Skip to content

Conversation

@adasatorres
Copy link
Contributor

This implementation adds an option in the template to create the invoice and automatically create the payment, using the last payment token used by the customer.

@adasatorres adasatorres force-pushed the 16.0-imp-subscription_oca branch from 9e7db3c to 62928eb Compare October 30, 2025 15:28
@chrisandrewmann
Copy link

chrisandrewmann commented Oct 31, 2025

@adasatorres I did a quick test on runbot.

  1. Using "Azure Interior, Brandon Freeman", create saved payment token using "Demo" payment provider
  2. Create Subscription Template (monthly), setting the Invoicing Mode to "Invoice & Recurring Payment"
  3. Create new Subscription and add a product
  4. Manually run the scheduled action "Subscriptions Management"
  5. Error thrown below
Traceback (most recent call last):
  File "/opt/odoo/odoo/api.py", line 1013, in get
    cache_value = field_cache[record._ids[0]]
KeyError: 45

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/fields.py", line 1161, in __get__
    value = env.cache.get(record, self)
  File "/opt/odoo/odoo/api.py", line 1020, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'account.move.line(45,).name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1848, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo/service/model.py", line 152, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 1876, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 2080, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 763, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 47, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 34, in _call_kw
    return call_kw(Model, method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 484, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 469, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/addons/base/models/ir_cron.py", line 104, in method_direct_trigger
    self.env.flush_all()
  File "/opt/odoo/odoo/api.py", line 761, in flush_all
    self._recompute_all()
  File "/opt/odoo/odoo/api.py", line 757, in _recompute_all
    self[field.model_name]._recompute_field(field)
  File "/opt/odoo/odoo/models.py", line 6335, in _recompute_field
    field.recompute(records)
  File "/opt/odoo/odoo/fields.py", line 1382, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo/fields.py", line 1355, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo/fields.py", line 1404, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 4276, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 98, in determine
    return needle(*args)
  File "/opt/odoo/addons/account/models/account_move_line.py", line 483, in _compute_name
    if not line.name or line._origin.name == line._origin.move_id.payment_reference:
  File "/opt/odoo/odoo/fields.py", line 1187, in __get__
    recs._fetch_field(self)
  File "/opt/odoo/odoo/models.py", line 3245, in _fetch_field
    self._read(fnames)
  File "/opt/odoo/odoo/models.py", line 3322, in _read
    cr.execute(query_str, params + [sub_ids])
  File "/opt/odoo/odoo/sql_db.py", line 324, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block


The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://oca-contract-16-0-pr1331-62928ebfb7e6.runboat.odoo-community.org/web/assets/429-ecc5975/web.assets_backend.min.js:1003:163)
        at XMLHttpRequest.<anonymous> (http://oca-contract-16-0-pr1331-62928ebfb7e6.runboat.odoo-community.org/web/assets/429-ecc5975/web.assets_backend.min.js:1011:13)

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

Successfully merging this pull request may close these issues.

2 participants