Erreur au niveau du Wizard Wrong wizard model in keyword action

Bonjour à vous,

J’espère que vous allez bien.

Dans le processus d’utilisation des table_query comme m’a conseillé un des membres, J’essaie de les utiliser convenablement avec des actions Wizard.

Du coup mon table_query fonctionne bien d’après mes tests, mais je veux utiliser un wizard pour modifier les éléments d’entrées.

Lorsque j’utilise le wizard, j’ai ce problème

 Tryton
Actions
 
Administrator [XAF]
×Fermer
Administration / ...
Administration / Modules85 / 92
Rechercher
Lancer l'activation/mise à jour en attente (z_all_synthesis)

 
Votre système va être mis à niveau.
Cette opération peut prendre quelques minutes.
 
Modules à mettre à jour
z_all_synthesis: to upgrade
 
Erreur applicative
Avertissement :
Traceback (most recent call last):
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 459, in parse_xmlstream
    self.sax_parser.parse(source)
  File "/xml/sax/expatreader.py", line 105, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/xml/sax/xmlreader.py", line 124, in parse
    self.feed(buffer)
  File "/xml/sax/expatreader.py", line 211, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 475, in EndElement
  File "/xml/sax/expatreader.py", line 344, in end_element
    self._cont_handler.endElement(name)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 514, in endElement
    self.taghandler = self.taghandler.endElement(name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 157, in endElement
    self.mh.import_record('ir.ui.menu', self.values, self.xml_id)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 684, in import_record
    self.write_records(module, model,
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 741, in write_records
    Model.write(*to_update)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelsql.py", line 165, in wrapper
    return func(cls, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelsql.py", line 1061, in write
    field.set(cls, fname, *fargs)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/fields/function.py", line 121, in set
    setter(Model.browse(ids), name, value)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/ir/ui/menu.py", line 222, in set_action
    ActionKeyword.create(to_create)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/ir/action.py", line 224, in create
    return super(ActionKeyword, cls).create(new_vlist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelsql.py", line 165, in wrapper
    return func(cls, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelsql.py", line 685, in create
    cls._validate(sub_records)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelstorage.py", line 79, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/model/modelstorage.py", line 1417, in _validate
    cls.validate(records)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/ir/action.py", line 176, in validate
    action.check_wizard_model()
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/ir/action.py", line 190, in check_wizard_model
    raise WizardModelError(
trytond.ir.action.WizardModelError: Wrong wizard model in keyword action "Syntheses des Ventes par Assurances". - 

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

Traceback (most recent call last):
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/protocols/dispatcher.py", line 46, in rpc
    return methods.get(request.rpc_method, _dispatch)(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/wsgi.py", line 84, in auth_required
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/protocols/wrappers.py", line 181, in wrapper
    return func(request, pool, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/protocols/dispatcher.py", line 180, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/wizard/wizard.py", line 313, in execute
    return wizard._execute(state_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/wizard/wizard.py", line 344, in _execute
    result = self._execute(transition())
                           ^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/ir/module.py", line 572, in transition_upgrade
    pool.init(update=update, lang=lang)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/pool.py", line 164, in init
    restart = not load_modules(
                  ^^^^^^^^^^^^^
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/modules/__init__.py", line 446, in load_modules
    _load_modules(update)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/modules/__init__.py", line 411, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/modules/__init__.py", line 252, in load_module_graph
    tryton_parser.parse_xmlstream(fp)
  File "/gnuhealth/tryton/server/trytond-6.0.55/trytond/convert.py", line 461, in parse_xmlstream
    raise Exception("Error " + self.current_state()) from e
Exception: Error Tag menuitem with id z_all_synthesis.menu_act_syntheses_assurances_form

Voici mes différentes class :

class Elements_Actualisations(ModelView):
    'Les Élements D\'actualisations du rapports'
    __name__ = 'elements.refresh.init'

    date_debut = fields.Date("Date de Début", required=True)
    date_fin = fields.Date("Date de Fin", required=True)


    @staticmethod
    def default_date_debut():
        return datetime.now()
    
    @staticmethod
    def default_date_fin():
        return datetime.now()

    vente_assurance = fields.Boolean("Ventes Par Assurances", help="Cocher si vous voulez faire une actualisation des ventes par assurance")


class GenerateResultsReports(Wizard):
    'Generation des Rapports En Totalité'
    __name__ = 'rapports.refresh.all'

    start = StateView('elements.refresh.init',
        'z_all_synthesis.view_element_actualisation', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Open', 'open_', 'tryton-ok',
                True),
            ])
    open_ = StateAction('z_all_synthesis.act_syntheses_assurances_form2')
    
    def do_open_(self, action):
        if self.start.vente_assurance :
            action['pyson_context'] = PYSONEncoder().encode({
            'date_start': self.start.date_start,
            'date_end': self.start.date_end,
            'vente_assurance': self.start.vente_assurance,
            })

            action['name'] = "Ventes Par Assurance"

        return action, {}

    def transition_open_(self):
        return 'end'

Et le xml qui pose problème

<?xml version="1.0" encoding="utf-8"?>
<tryton>
    <data>

<!-- ACTION POUR SYNTHESE DES RAPPORTS ET GRAPH LIGNE PAR LIGNE  -->
              
        <record model="ir.ui.view" id="view_element_actualisation">
            <field name="model">elements.refresh.init</field>
            <field name="type">form</field>
            <field name="name">elt_actualisation</field>
        </record>

        <record model="ir.action.wizard" id="act_actualize_elements">
            <field name="name">Syntheses des Ventes par Assurances</field>
            <field name="wiz_name">rapports.refresh.all</field>
        </record>
    
        <menuitem
            parent="menu_rapport"
            action="act_actualize_elements"
            sequence="10"
            id="menu_act_syntheses_assurances_form"/>

    </data>
</tryton>

J’espère que vous pourriez m’aider.
Merci d’avance

Est-ce que ton wizard est déclaré dans __init__.py ?

Oui il est bien déclaré

# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

from trytond.pool import Pool
from . import z_all_synthesis
from .wizard import generate_report

__all__ = ['register']


def register():
    Pool.register(
        z_all_synthesis.Classement_Assurance_vente,
        generate_report.Elements_Actualisations,
        module='z_all_synthesis', type_='model')
    Pool.register(
        generate_report.GenerateResultsReports,
        module='z_all_synthesis', type_='wizard')
    Pool.register(
        module='z_all_synthesis', type_='report')

Hi, could you share your module structure?
this import from .wizard import generate_report does not look good for me.
Maybe you could try with something like:

from . import wizard

Pool.register(
    wizard.GenerateResultsReports,
[...]

But im just guessing your files.

Hope this helps.

It seems that you have already registerer the ir.action.wizard with a model (and than you removed from the XML).
If you are using a database that you have updated with the model, you must explicitly remove it by adding <field name="model" eval="None"/>.

Thank you. Ceci Marche à la perfection

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.