Create Wizard on 6.6

Hi,

I’m creating a Wizard, I have created the models and xml file.

        <record model="ir.ui.view" id="print_cash_flow_start_view_form">
            <field name="model">print.cash_flow.start</field>
            <field name="type">form</field>
            <field name="name">print_cash_flow_start_form</field>
        </record>
        <record model="ir.action.wizard" id="act_wiz_cash_flow">
            <field name="name">Cash Flow</field>
            <field name="wiz_name">print.cash_flow.wizard</field>
        </record>
        <menuitem parent="account.menu_reporting" action="act_wiz_cash_flow"
            id="menu_print_cash_flow" icon="tryton-print" sequence="150"/>
       <record model="ir.action.report" id="report_cash_flow">
            <field name="name">Cash Flow</field>
            <field name="model">account.account.type</field>
            <field name="report_name">cash_flow.report</field>
            <field name="report">account_report/cash_flow.html</field>
            <field name="template_extension">html</field>
            <field name="extension">pdf</field>
        </record>
class PrintCashFlowStart(ModelView):
    'Cash Flow Start'
    __name__ = 'print.cash_flow.start'

    company = fields.Many2One('company.company', "Company", readonly=True,
        required=True,
        domain=[
            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
                Eval('context', {}).get('company', -1)),
            ])

    @classmethod
    def default_company(cls):
        return Transaction().context.get('company')

class PrintCashFlowWizard(Wizard):
    'Cash Flow Wizard'
    __name__ = 'print.cash_flow.wizard'

    start = StateView('print.cash_flow.start',
        'account_report.print_cash_flow_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
            ])
    print_ = StateReport('cash_flow.report')

    def do_print_(self, action):
        data = {
            'company': self.start.company.id,
            }
        return action, data

class CashFlowReport(Report):
    'Cash Flow Report'
    __name__ = 'cash_flow.report'

I have created various wizards before with similar code but know I’m working on version 6.6 and I receive the follow message: “No action defined.”

I appreciate any help.

Could you describe exactly when are you receiving this message? Also what is the communication between the client and the server?

When I click the menuitem I don’t receive any message neither in the console, but when I search it on action field and click it I receive the message “No action defined”.

I also tried to add the wizard action in users form in Actions tab when I sign in it display correctly the Wizard.

Not sure if something is bad with the menuitem definition.

I don’t receive any log or error in the server or the client (sao or tryton).

OK so it seems that the menuitem did not create the proper keyword for ir.ui.menu. This is strange because this code is used thousands times (for every menu entry).
So I guess the database update has some warnings to check.

1 Like

I updated all modules of the database with only this warning.

WARNING trytond.convert Field mon_thousands_sep of 25@ir.lang not updated (id: lang_uk), because it has changed since the last update

Also checked for Administration > Model > Model > Data to see records without sync but nothing found.

Also I created a test_scenario for the Wizard, and it works fine.

if __name__ == '__main__':
    config.set_xmlrpc(
        url='http://{user}:{password}@{host}:{port}/{db}/'.format(
            user=USER, password=PASSWORD, host=HOST, port=PORT, db=DB))
    current_config = config.get_config()
    print_flow_cash = Wizard('print.cash_flow')
    print_flow_cash.execute('print_')

As you mentioned, I checked and effectively the keyword is not created. I tried to create 3 wizards more with their menus and is the same thing.

UPDATE:
I added manually the correct action and it works, but not sure why is it not added automatically.

The only cases where the action could not be set is if the value is empty or the id is negative, see trytond: bc5ffeed2bf3 trytond/ir/ui/menu.py

I don’t know why the method doesn’t load, models and actions are created correctly, so it must work. Another way to make sure if the menu is well created and working?

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