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

[FIX] hw_escpos: wrong number of argument in write function #1

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from

Conversation

robinkeunen
Copy link
Member

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@houssine78
Copy link

@robinkeunen I think that the policy to submit a PR on OCB is to submit the same PR on Odoo and to put a reference on it here.

remytms pushed a commit that referenced this pull request Aug 6, 2019
Have an inherited view replacing a node in its parent
namely:

```
<view name="1">
<world/>
<world/>
<world/>
</view>
```

Inherited by
```
<view name="2" inherit_id="1">
<xpath expr="//world[1]" position="replace">
<world/>
</xpath>
</view>
```

Before this commit, the resulting xpath branding of the nodes
(useful for web_editor, to know where it is supposed to anchor new elements)
was incorrect. Note that there is the branding attr data-oe-view_id which specifies in which view they are

The 2nd and 3rd world in view #1 were numbered respectively world[1] and world[2]
which is incorrect since we *know* those should be world[2] and world[3]
(in their own view, i.e. in view #1)
This was because when replacing the node, the code lost track of what it replaced
and that it attributed the inheriting branding to the replacing nodes

After this commit, the 2nd and 3rd world nodes are numbered
world[2] and world[3] respectively

OPW 2007312

closes odoo#35134

Signed-off-by: Lucas Perais (lpe) <[email protected]>
carmenbianca pushed a commit that referenced this pull request Oct 26, 2022
When installing l10n_mx, a error occurs

    Traceback (most recent call last):
    File "/data/build/odoo/odoo/service/server.py", line 1289, in preload_registries
        registry = Registry.new(dbname, update_module=update_module)
    File "<decorator-gen-15>", line 2, in new
    File "/data/build/odoo/odoo/tools/func.py", line 87, in locked
        return func(inst, *args, **kwargs)
    File "/data/build/odoo/odoo/modules/registry.py", line 91, in new
        odoo.modules.load_modules(registry, force_demo, status, update_module)
    File "/data/build/odoo/odoo/modules/loading.py", line 482, in load_modules
        processed_modules += load_marked_modules(cr, graph,
    File "/data/build/odoo/odoo/modules/loading.py", line 371, in load_marked_modules
        loaded, processed = load_module_graph(
    File "/data/build/odoo/odoo/modules/loading.py", line 206, in load_module_graph
        registry.setup_models(cr)
    File "/data/build/odoo/odoo/modules/registry.py", line 289, in setup_models
        model._setup_fields()
    File "/data/build/odoo/odoo/models.py", line 3294, in _setup_fields
        field.setup(self)
    File "/data/build/odoo/odoo/fields.py", line 512, in setup
        self.setup_nonrelated(model)
    File "/data/build/odoo/odoo/fields.py", line 4524, in setup_nonrelated
        m2m = model.pool._m2m
    AttributeError: 'Registry' object has no attribute '_m2m'

Since odoo#99438 hr is sintalled automatically
This means that when doing a -i l10n_mx, hr is installed too

hr will conditionnaly call a button_immediate_install in this case.

What's going on after that: It's a mess

button_immediate_install will create another registry
This registry will be present on some models that will ne used later
by the initial registry creating the missing _m2m case

For the record, here are some of the strange and key element during
the install

    2022-09-21 16:31:27,691 2579263 INFO test_mx odoo.modules.loading: loading 1 modules...
    2022-09-21 16:31:27,691 2579263 INFO test_mx odoo.modules.loading: Loading module base (1/1)
    ...
    2022-09-21 16:31:36,222 2579263 INFO test_mx odoo.modules.loading: Module base loaded in 8.53s, 8902 queries (+8902 other)
    2022-09-21 16:31:36,222 2579263 INFO test_mx odoo.modules.loading: 1 modules loaded in 8.53s, 8902 queries (+8902 extra)
    2022-09-21 16:31:36,240 2579263 INFO test_mx odoo.modules.loading: updating modules list
    2022-09-21 16:31:36,241 2579263 INFO test_mx odoo.addons.base.models.ir_module: ALLOW access to module.update_list on [] to user __system__ #1 via n/a
    2022-09-21 16:31:36,943 2579263 INFO test_mx odoo.addons.base.models.ir_module: ALLOW access to module.button_install on ['Mexico - Accounting'] to user __system__ #1 via n/a
    ...
    2022-09-21 16:31:49,775 2579263 INFO test_mx odoo.modules.loading: Loading module base_install_request (26/78)
    ...
    2022-09-21 16:31:50,043 2579263 INFO test_mx odoo.addons.base.models.ir_module: ALLOW access to module.button_install on ['Project', 'Email Marketing', 'Employees', 'Knowledge', 'Sign', 'Planning', 'Appointments', 'Surveys'] to user __system__ #1 via n/a
    2022-09-21 16:31:50,167 2579263 INFO test_mx odoo.modules.loading: Module base_install_request loaded in 0.39s, 228 queries (+228 other)
    ...
    2022-09-21 16:32:10,816 2579263 INFO test_mx odoo.modules.loading: Loading module l10n_mx (55/78)
    ...
    2022-09-21 16:32:17,618 2579263 INFO test_mx odoo.modules.loading: Module l10n_mx loaded in 6.80s, 4302 queries (+4332 other)
    ...
    2022-09-21 16:32:50,371 2579263 INFO test_mx odoo.modules.loading: Loading module hr (35/112)
    2022-09-21 16:32:57,594 2579263 INFO test_mx odoo.addons.base.models.ir_module: ALLOW access to module.button_immediate_install on ['Employees - Mexico'] to user __system__ #1 via n/a
    2022-09-21 16:32:57,594 2579263 INFO test_mx odoo.addons.base.models.ir_module: User #1 triggered module installation
    2022-09-21 16:32:57,595 2579263 INFO test_mx odoo.addons.base.models.ir_module: ALLOW access to module.button_install on ['Employees - Mexico'] to user __system__ #1 via n/a
    ...
    2022-09-21 16:32:58,558 2579263 ERROR test_mx odoo.modules.registry: Creating Registry <odoo.modules.registry.Registry object at 0x7f02cc0e8130>
    Stack (most recent call last):
    File "/home/xdo/osrc/master/odoo/odoo-bin", line 8, in <module>
        odoo.cli.main()
    File "/home/xdo/osrc/master/odoo/odoo/cli/command.py", line 56, in main
        o.run(args)
    File "/home/xdo/osrc/master/odoo/odoo/cli/server.py", line 179, in run
        main(args)
    File "/home/xdo/osrc/master/odoo/odoo/cli/server.py", line 173, in main
        rc = odoo.service.server.start(preload=preload, stop=stop)
    File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 1391, in start
        rc = server.run(preload, stop)
    File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 570, in run
        rc = preload_registries(preload)
    File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 1289, in preload_registries
        registry = Registry.new(dbname, update_module=update_module)
    File "<decorator-gen-15>", line 2, in new
    File "/home/xdo/osrc/master/odoo/odoo/tools/func.py", line 87, in locked
        return func(inst, *args, **kwargs)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 91, in new
        odoo.modules.load_modules(registry, force_demo, status, update_module)
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 482, in load_modules
        processed_modules += load_marked_modules(cr, graph,
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 371, in load_marked_modules
        loaded, processed = load_module_graph(
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 248, in load_module_graph
        getattr(py_module, post_init)(cr, registry)
    File "/home/xdo/osrc/master/odoo/addons/hr/__init__.py", line 19, in _install_hr_localization
        l10n_mx.button_immediate_install()
    File "<decorator-gen-74>", line 2, in button_immediate_install
    File "/home/xdo/osrc/master/odoo/odoo/addons/base/models/ir_module.py", line 75, in check_and_log
        return method(self, *args, **kwargs)
    File "/home/xdo/osrc/master/odoo/odoo/addons/base/models/ir_module.py", line 486, in button_immediate_install
        return self._button_immediate_function(type(self).button_install)
    File "/home/xdo/osrc/master/odoo/odoo/addons/base/models/ir_module.py", line 607, in _button_immediate_function
        registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
    File "<decorator-gen-15>", line 2, in new
    File "/home/xdo/osrc/master/odoo/odoo/tools/func.py", line 87, in locked
        return func(inst, *args, **kwargs)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 79, in new
        registry.init(db_name)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 115, in init
        _logger.error(self, stack_info=True)
    2022-09-21 16:32:58,580 2579263 INFO test_mx odoo.modules.loading: loading 1 modules...
    2022-09-21 16:32:58,581 2579263 INFO test_mx odoo.modules.loading: Loading module base (1/1)
    ...
    2022-09-21 16:33:35,294 2579263 INFO test_mx odoo.modules.loading: Loading module base_install_request (30/85)
    ...
    2022-09-21 16:33:35,745 2579263 INFO test_mx odoo.modules.loading: Module base_install_request loaded in 0.45s, 131 queries (+131 other)
    ...
    2022-09-21 16:34:05,789 2579263 INFO test_mx odoo.modules.loading: Loading module l10n_mx (62/85)
    ...
    2022-09-21 16:34:28,497 2579263 INFO test_mx odoo.modules.loading: Loading module hr (35/113)
    ...
    2022-09-21 16:34:32,067 2579263 INFO test_mx odoo.modules.loading: Module hr loaded in 3.57s, 4092 queries (+4092 other)
    2022-09-21 16:34:32,067 2579263 INFO test_mx odoo.modules.loading: Loading module link_tracker (37/113)
    ...
    2022-09-21 16:34:32,690 2579263 INFO test_mx odoo.modules.loading: Module link_tracker loaded in 0.62s, 267 queries (+267 other)
    ...
    2022-09-21 16:35:04,063 2579263 INFO test_mx odoo.modules.loading: Modules loaded.
    2022-09-21 16:35:04,068 2579263 INFO test_mx odoo.modules.registry: Registry loaded in 125.514s
    2022-09-21 16:35:04,068 2579263 INFO test_mx odoo.addons.base.models.ir_module: getting next ir.actions.todo()
    2022-09-21 16:35:04,071 2579263 INFO test_mx odoo.addons.base.models.ir_module: next action is "Open Menu"
    2022-09-21 16:35:04,094 2579263 INFO test_mx odoo.modules.loading: Module hr loaded in 133.72s, 4344 queries (+81420 other)
    ...
    2022-09-21 16:35:04,094 2579263 INFO test_mx odoo.modules.loading: Loading module link_tracker (37/112)
    2022-09-21 16:35:04,163 2579263 ERROR test_mx odoo.modules.registry:
    setuping model: ir.model.fields()
    registry on model: <odoo.modules.registry.Registry object at 0x7f02cc0e8130>
    registry calling setup_models: <odoo.modules.registry.Registry object at 0x7f02e92399d0>

    2022-09-21 16:35:04,164 2579263 WARNING test_mx odoo.modules.loading: Transient module states were reset
    2022-09-21 16:35:04,165 2579263 ERROR test_mx odoo.modules.registry: Failed to load registry
    2022-09-21 16:35:04,165 2579263 CRITICAL test_mx odoo.service.server: Failed to initialize database `test_mx`.
    Traceback (most recent call last):
    File "/home/xdo/osrc/master/odoo/odoo/service/server.py", line 1289, in preload_registries
        registry = Registry.new(dbname, update_module=update_module)
    File "<decorator-gen-15>", line 2, in new
    File "/home/xdo/osrc/master/odoo/odoo/tools/func.py", line 87, in locked
        return func(inst, *args, **kwargs)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 91, in new
        odoo.modules.load_modules(registry, force_demo, status, update_module)
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 482, in load_modules
        processed_modules += load_marked_modules(cr, graph,
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 371, in load_marked_modules
        loaded, processed = load_module_graph(
    File "/home/xdo/osrc/master/odoo/odoo/modules/loading.py", line 206, in load_module_graph
        registry.setup_models(cr)
    File "/home/xdo/osrc/master/odoo/odoo/modules/registry.py", line 293, in setup_models
        model._setup_fields()
    File "/home/xdo/osrc/master/odoo/odoo/models.py", line 3294, in _setup_fields
        field.setup(self)
    File "/home/xdo/osrc/master/odoo/odoo/fields.py", line 512, in setup
        self.setup_nonrelated(model)
    File "/home/xdo/osrc/master/odoo/odoo/fields.py", line 4524, in setup_nonrelated
        m2m = model.pool._m2m
    AttributeError: 'Registry' object has no attribute '_m2m'

Naive fix here: use button_install instead of button_immediate_install
(not even sure this is 100% correct)

All calls to button_immediate_install should be fixed maybe to avoid
a registryloadingception

closes odoo#100909

X-original-commit: 919c1f3
Signed-off-by: Yannick Tivisse (yti) <[email protected]>
Signed-off-by: Xavier Dollé (xdo) <[email protected]>
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