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] Crash upon restart with -u sale #47

Open
alexis-via opened this issue Nov 4, 2020 · 0 comments
Open

[10.0] Crash upon restart with -u sale #47

alexis-via opened this issue Nov 4, 2020 · 0 comments

Comments

@alexis-via
Copy link
Member

On an odoo v10 server with payment_gateway and payment_gateway_stripe installed, when I restart odoo with -u sale, I get the following error:

2020-11-04 22:15:33,406 30291 INFO adl201104 odoo.modules.registry: module payment_gateway: creating or updating database tables
2020-11-04 22:15:34,197 30291 INFO adl201104 odoo.modules.loading: loading payment_gateway/views/account_payment_mode_view.xml
2020-11-04 22:15:35,070 30291 ERROR adl201104 odoo.models: Exception while validating constraint
Traceback (most recent call last):
  File "/home/odoo/erp/odoo/odoo/models.py", line 1078, in _validate_fields
    check(self)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 286, in _check_xml
    self.postprocess_and_fields(view.model, view_doc, view.id)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 887, in postprocess_and_fields
    fields = Model.fields_get(None)
  File "/home/odoo/erp/odoo/odoo/models.py", line 2937, in fields_get
    description = field.get_description(self.env)
  File "/home/odoo/erp/odoo/odoo/fields.py", line 782, in get_description
    value = value(env)
  File "/home/odoo/erp/odoo/odoo/fields.py", line 1780, in _description_selection
    return getattr(env[self.model_name], selection)()
  File "/home/odoo/erp/payment-gateway/payment_gateway/models/account_payment_mode.py", line 35, in _selection_provider
    states=('installed', 'to upgrade', 'to install'))
  File "/home/odoo/erp/connector/component/builder.py", line 90, in build_registry
    components_registry=components_registry)
  File "/home/odoo/erp/connector/component/builder.py", line 107, in load_components
    components_registry.load_components(module)
  File "/home/odoo/erp/connector/component/core.py", line 103, in load_components
    component_class._build_component(self)
  File "/home/odoo/erp/connector/component/core.py", line 803, in _build_component
    name)
TypeError: Component 'payment.service.stripe' does not exist in registry.
2020-11-04 22:15:35,079 30291 WARNING adl201104 odoo.modules.loading: Transient module states were reset
2020-11-04 22:15:35,080 30291 ERROR adl201104 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "/home/odoo/erp/odoo/odoo/modules/registry.py", line 83, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 373, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 270, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 182, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 96, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 846, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 916, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 800, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 708, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_model.py", line 1213, in _update
    record.write(values)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 383, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/erp/connector/connector/producer.py", line 37, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/telephony/base_phone/models/base.py", line 22, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3612, in write
    field.determine_inverse(records)
  File "/home/odoo/erp/odoo/odoo/fields.py", line 1064, in determine_inverse
    getattr(records, self.inverse)()
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 220, in _inverse_arch
    view.write(data)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 383, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/erp/connector/connector/producer.py", line 37, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/telephony/base_phone/models/base.py", line 22, in write
    return super(Base, self).write(vals)
  File "/home/odoo/erp/connector/component_event/models/base.py", line 99, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3592, in write
    self._write(old_vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3761, in _write
    self._validate_fields(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 1083, in _validate_fields
    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
ParseError: "Erreur lors de la validation de la contrainte

Component 'payment.service.stripe' does not exist in registry.
None" while parsing /home/odoo/erp/payment-gateway/payment_gateway/views/account_payment_mode_view.xml:3, near
<record id="payment_gateway_account_payment_mode_view_form" model="ir.ui.view">
        <field name="model">account.payment.mode</field>
        <field name="inherit_id" ref="account_payment_mode.account_payment_mode_form"/>
        <field name="arch" type="xml">
            <field name="variable_journal_ids" position="after">
                <field name="provider"/>
                <field name="capture_payment" attrs="{'invisible': [('provider', '=', False)],                             'required': [('provider', '!=', False)]}"/>
                <field name="provider_account"/>
            </field>
        </field>
    </record>
2020-11-04 22:15:35,082 30291 CRITICAL adl201104 odoo.service.server: Failed to initialize database `adl201104`.
Traceback (most recent call last):
  File "/home/odoo/erp/odoo/odoo/service/server.py", line 974, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/odoo/erp/odoo/odoo/modules/registry.py", line 83, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 373, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 270, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 182, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/home/odoo/erp/odoo/odoo/modules/loading.py", line 96, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 846, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 916, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 800, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/home/odoo/erp/odoo/odoo/tools/convert.py", line 708, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_model.py", line 1213, in _update
    record.write(values)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 383, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/erp/connector/connector/producer.py", line 37, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/telephony/base_phone/models/base.py", line 22, in write
    return super(Base, self).write(vals)
  File "/home/odoo/erp/connector/component_event/models/base.py", line 99, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3612, in write
    field.determine_inverse(records)
  File "/home/odoo/erp/odoo/odoo/fields.py", line 1064, in determine_inverse
    getattr(records, self.inverse)()
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 220, in _inverse_arch
    view.write(data)
  File "/home/odoo/erp/odoo/odoo/addons/base/ir/ir_ui_view.py", line 383, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/erp/connector/connector/producer.py", line 37, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/telephony/base_phone/models/base.py", line 22, in write
    return super(Base, self).write(vals)
  File "/home/odoo/erp/connector/component_event/models/base.py", line 99, in write
    result = super(Base, self).write(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3592, in write
    self._write(old_vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 3761, in _write
    self._validate_fields(vals)
  File "/home/odoo/erp/odoo/odoo/models.py", line 1083, in _validate_fields
    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
ParseError: "Erreur lors de la validation de la contrainte

Component 'payment.service.stripe' does not exist in registry.
None" while parsing /home/odoo/erp/payment-gateway/payment_gateway/views/account_payment_mode_view.xml:3, near
<record id="payment_gateway_account_payment_mode_view_form" model="ir.ui.view">
        <field name="model">account.payment.mode</field>
        <field name="inherit_id" ref="account_payment_mode.account_payment_mode_form"/>
        <field name="arch" type="xml">
            <field name="variable_journal_ids" position="after">
                <field name="provider"/>
                <field name="capture_payment" attrs="{'invisible': [('provider', '=', False)],                             'required': [('provider', '!=', False)]}"/>
                <field name="provider_account"/>
            </field>
        </field>
    </record>

Then Odoo continues and works... but with very unexpected consequences.

Code analysis:
In the base module "payment_gateway", a field provider is added on account.payment.mode ; this is a selection field with a dynamic list, defined in the following method : https://github.com/akretion/payment-gateway/blob/10.0/payment_gateway/models/account_payment_mode.py#L28
When starting Odoo with "-u sale", the context has the 'install_mode' key and therefore it enters inside the first IF and it crashes in builder.build_registry(). The errors "TypeError: Component 'payment.service.stripe' does not exist in registry." refers to payment.service.stripe which is defined in the module payment_gateway_stripe (cf https://github.com/akretion/payment-gateway/blob/10.0/payment_gateway_stripe/services/payment_service.py#L37) and this module depends in payment_gateway, so it is loaded later.

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

1 participant