跳至内容
菜单
此问题已终结
3 回复
815 查看

Hello,


I did a stupid thing.

Tried to change my PDF of saleorder but erased the wrong file.


Now when I generate an example as a PDF I get an error.


Can I restore an older version? Or do I need to rename a different Report? I think I have a copy of the report but not sure how to rename it.

形象
丢弃
编写者 最佳答案

In reports, I guess the views, I deleted one of the files there.


I tried to Upgrade but I get an error.

I know I shouldn't messed with the files, did a copy of the file but erased it by mistake.

Error code:

Odoo-serverfout

RPC_ERROR

Odoo Server Error

Occured on marchand.odoo.com on model ir.module.module and id 20 on 2025-06-05 06:42:29 GMT

Traceback (most recent call last):
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 537, in _tag_root
    f(rec)
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 367, in _tag_record
    raise Exception("Cannot update missing record %r" % xid)
Exception: Cannot update missing record 'sale.action_report_saleorder'

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

Traceback (most recent call last):
  File "/home/odoo/src/odoo/18.0/odoo/http.py", line 1976, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 156, in retrying
    result = func()
             ^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/http.py", line 1943, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/http.py", line 2191, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/http.py", line 740, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/addons/web/controllers/dataset.py", line 42, in call_button
    action = call_kw(request.env[model], method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/api.py", line 533, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/addons/base/models/ir_module.py", line 75, in check_and_log
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/addons/base/models/ir_module.py", line 671, in button_immediate_upgrade
    return self._button_immediate_function(self.env.registry[self._name].button_upgrade)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/custom/trial/saas_trial/models/module.py", line 112, in _button_immediate_function
    res = super(IrModuleModule, self)._button_immediate_function(function)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/addons/base/models/ir_module.py", line 604, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/tools/func.py", line 97, in locked
    return func(inst, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/modules/registry.py", line 127, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/home/odoo/src/odoo/18.0/odoo/modules/loading.py", line 480, in load_modules
    processed_modules += load_marked_modules(env, graph,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/modules/loading.py", line 365, in load_marked_modules
    loaded, processed = load_module_graph(
                        ^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/18.0/odoo/modules/loading.py", line 228, in load_module_graph
    load_data(env, idref, mode, kind='data', package=package)
  File "/home/odoo/src/odoo/18.0/odoo/modules/loading.py", line 72, in load_data
    tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 608, in convert_file
    convert_xml_import(env, module, fp, idref, mode, noupdate)
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 679, in convert_xml_import
    obj.parse(doc.getroot())
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 594, in parse
    self._tag_root(de)
  File "/home/odoo/src/odoo/18.0/odoo/tools/convert.py", line 550, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing /home/odoo/src/odoo/18.0/addons/sale_pdf_quote_builder/report/ir_actions_report.xml:15, somewhere inside
<record id="sale.action_report_saleorder" model="ir.actions.report">
        <field name="name">PDF Quote</field>
    </record>

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (https://marchand.odoo.com/web/assets/7669bf4/web.assets_web.min.js:3148:163)
        at XMLHttpRequest.<anonymous> (https://marchand.odoo.com/web/assets/7669bf4/web.assets_web.min.js:3153:13)

This is the error code when I try to Upgrade

形象
丢弃
最佳答案

Hi,


1- If you're on:

Odoo.sh: You can roll back to a previous build.

Local instance: You can restore the file from your local Git history if you're using version control:

2- Re-import the Original Report File

If you have a backup .xml file of the report (e.g., sale_report_templates.xml), you can:

* Copy it into your module's views directory.

* Add it back to your __manifest__.py:


'data': [

    'views/sale_report_templates.xml',

],


* Restart the server and upgrade your module:

3- If you remove the report from the UI, try to upgrade the sales module.


Hope it helps

形象
丢弃
最佳答案

Quite some assumptions need to happen here:

  1. Assuming 'erased the wrong file' actually means a (.xml) file holding view or template definitions:
    1. Assuming it was a file you've created or modified yourself in the past:
      No, unless your files are tracked in a svn (usually a GitHub repository) or you have a backup of that file that can be put at the original position.
    2. Assuming it was a core file (actual Odoo source code) that has not been tempered with by any other means up to that point:
      Yes, you can find the core files in https://github.com/odoo/odoo (Odoo Community source code), https://github.com/odoo/enterprise (additional source code for Odoo Enterprise, in case applicable to your setup). The branches selection on the left and the history button within a file allows you to switch to a very specific version of that original core file.
  2. Assuming 'erased the wrong file' doesn't actually mean a file (which seems to be more probable) but a view stored in your Odoo database:
    1. Assuming it was a view you've created or modified yourself:
      No, unless your database has been backed up any time between your last modification to that view and its deletion.
    2. Assuming it was a core view (actual Odoo source code representation of that report inside your Odoo database) that has not been tempered with by any other means up to that point:
      Yes, you should be able to simply run an upgrade on the module that holds the definition of that view. You can do so from the Apps menu as well as from the CLI/terminal. In your case it would be the module 'Sales' (technical name 'sale'), but, upgrading 'Sales Management' (technical name 'sale_management') will be fine as well. However, you need to be aware about the fact, that ANY and ALL changes that have been performed in other core views of that module will be reset to its original state as well!

Also, future onwards - for above and so many more reasons: 
You really should not touch any core view definitions inside the database or their actual files. You will render your database 'un-upgradeable' [in the sense of bringing it to a newer version of Odoo] (unless manually recreating all these changes post-upgrade is something that makes you happy). Also also, installing other modules or upgrading them can fail in this scenario as well, due to the fact that other modules may depend on something you have changed or deleted within that view. See for example the 'Report Inheritance' tutorial: https://www.odoo.com/documentation/18.0/developer/tutorials/pdf_reports.html#report-inheritance

These changes should always be done in a custom module (or Odoo Studio, in case of Odoo Enterprise and your up for an adventure of sorts while upgrading to a newer version).

形象
丢弃
编写者

Hi Chris,

I tied a bunch of things and the problem remains. It states that the file is “missing”. Although I can see what I presume is the right file. I think it is a small thing but now I don’t dare to act any further so I don’t mess up even more.

Difficult to say based on that comment. What's about 'It states that the file is “missing”.' exactly?

相关帖文 回复 查看 活动
1
6月 25
103
1
6月 25
112
1
6月 25
98
0
6月 25
76
0
6月 25
83